acecalisto3 commited on
Commit
bfb6cb8
1 Parent(s): 465b684

Update supplemental.py

Browse files
Files changed (1) hide show
  1. supplemental.py +10 -12
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
- prompt = f"""
104
  Based on the following project description, generate a ProjectConfig object:
105
 
106
  Description: {project_description}
@@ -113,17 +113,15 @@ The ProjectConfig should include:
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"""
@@ -235,6 +233,6 @@ Consider the following in your suggestions:
235
  3. Applying design patterns where appropriate
236
  4. Optimizing performance (if applicable)
237
 
238
- Provide specific suggestions and explain the benefits of each.
239
  """
240
  return self.generate_agent_response(prompt)
 
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
  def implement_feature(self, feature_description: str, existing_code: Optional[str] = None) -> str:
127
  prompt = f"""
 
233
  3. Applying design patterns where appropriate
234
  4. Optimizing performance (if applicable)
235
 
236
+ Provide specific suggestions and code examples.
237
  """
238
  return self.generate_agent_response(prompt)