@@ -62,26 +62,27 @@ async def initialize_spec(self) -> AgentResponse:
62
62
# nothing but repeat the question. We reproduce this bug for bug here.
63
63
return AgentResponse .done (self )
64
64
65
- spec = response .text .strip ()
65
+ user_description = response .text .strip ()
66
66
67
- complexity = await self .check_prompt_complexity (spec )
67
+ complexity = await self .check_prompt_complexity (user_description )
68
68
await telemetry .trace_code_event (
69
69
"project-description" ,
70
70
{
71
- "initial_prompt" : spec ,
71
+ "initial_prompt" : user_description ,
72
72
"complexity" : complexity ,
73
73
},
74
74
)
75
75
76
- if len (spec ) < ANALYZE_THRESHOLD and complexity != Complexity .SIMPLE :
77
- spec = await self .analyze_spec (spec )
78
- spec = await self .review_spec (spec )
76
+ if len (user_description ) < ANALYZE_THRESHOLD and complexity != Complexity .SIMPLE :
77
+ initial_spec = await self .analyze_spec (user_description )
78
+ reviewed_spec = await self .review_spec (desc = user_description , spec = initial_spec )
79
79
80
80
self .next_state .specification = self .current_state .specification .clone ()
81
- self .next_state .specification .original_description = spec
82
- self .next_state .specification .description = spec
81
+ self .next_state .specification .original_description = user_description
82
+ self .next_state .specification .description = reviewed_spec
83
83
self .next_state .specification .complexity = complexity
84
- telemetry .set ("initial_prompt" , spec )
84
+ telemetry .set ("initial_prompt" , user_description )
85
+ telemetry .set ("updated_prompt" , reviewed_spec )
85
86
telemetry .set ("is_complex_app" , complexity != Complexity .SIMPLE )
86
87
87
88
self .next_state .action = SPEC_STEP_NAME
@@ -203,11 +204,11 @@ async def analyze_spec(self, spec: str) -> str:
203
204
n_answers += 1
204
205
convo .user (user_response .text )
205
206
206
- async def review_spec (self , spec : str ) -> str :
207
- convo = AgentConvo (self ).template ("review_spec" , spec = spec )
207
+ async def review_spec (self , desc : str , spec : str ) -> str :
208
+ convo = AgentConvo (self ).template ("review_spec" , desc = desc , spec = spec )
208
209
llm = self .get_llm (SPEC_WRITER_AGENT_NAME )
209
210
llm_response : str = await llm (convo , temperature = 0 )
210
211
additional_info = llm_response .strip ()
211
212
if additional_info and len (additional_info ) > 6 :
212
- spec += "\n Additional info/examples:\n " + additional_info
213
+ spec += "\n \ n Additional info/examples:\n \n " + additional_info
213
214
return spec
0 commit comments