Spaces:
Sleeping
Sleeping
acecalisto3
commited on
Commit
•
465b684
1
Parent(s):
ccaa238
Update supplemental.py
Browse files- supplemental.py +10 -2
supplemental.py
CHANGED
@@ -100,7 +100,7 @@ class EnhancedAIAgent:
|
|
100 |
return project_files
|
101 |
|
102 |
def generate_project_config(self, project_description: str) -> ProjectConfig:
|
103 |
-
|
104 |
Based on the following project description, generate a ProjectConfig object:
|
105 |
|
106 |
Description: {project_description}
|
@@ -113,9 +113,17 @@ The ProjectConfig should include:
|
|
113 |
|
114 |
Respond with a JSON object representing the ProjectConfig.
|
115 |
"""
|
116 |
-
|
|
|
|
|
117 |
config_dict = json.loads(response)
|
118 |
return ProjectConfig(**config_dict)
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
def implement_feature(self, feature_description: str, existing_code: Optional[str] = None) -> str:
|
121 |
prompt = f"""
|
|
|
100 |
return project_files
|
101 |
|
102 |
def generate_project_config(self, project_description: str) -> ProjectConfig:
|
103 |
+
prompt = f"""
|
104 |
Based on the following project description, generate a ProjectConfig object:
|
105 |
|
106 |
Description: {project_description}
|
|
|
113 |
|
114 |
Respond with a JSON object representing the ProjectConfig.
|
115 |
"""
|
116 |
+
response = self.generate_agent_response(prompt)
|
117 |
+
|
118 |
+
try:
|
119 |
config_dict = json.loads(response)
|
120 |
return ProjectConfig(**config_dict)
|
121 |
+
except JSONDecodeError as e:
|
122 |
+
self.logger.error(f"Error decoding JSON: {str(e)}")
|
123 |
+
self.logger.error(f"Response from model: {response}")
|
124 |
+
return None # Or handle the error differently
|
125 |
+
|
126 |
+
|
127 |
|
128 |
def implement_feature(self, feature_description: str, existing_code: Optional[str] = None) -> str:
|
129 |
prompt = f"""
|