Jeremy Live commited on
Commit
bb8f6fb
·
1 Parent(s): b62e4ec
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -157,7 +157,10 @@ def run_crewai_process(user_query, model, temperature):
157
  return # Exit the generator
158
 
159
  # Format for Gradio Chatbot (list of dictionaries for type='messages')
160
- final_answer_chat.append({"role": "assistant", "content": "Code generation complete. See the 'Generated Code' box. Attempting to execute code..."})
 
 
 
161
  yield agent_thoughts, final_answer_chat, generated_code, execution_output, generated_plot_path
162
 
163
  # --- Execute the generated code ---
@@ -209,9 +212,12 @@ def run_crewai_process(user_query, model, temperature):
209
  execution_output = "No code was generated to execute."
210
 
211
  # Update final answer chat to reflect execution attempt
212
- final_answer_chat.append({"role": "assistant", "content": f"Code execution finished. See 'Execution Output'."})
 
 
 
213
  if generated_plot_path:
214
- final_answer_chat.append({"role": "assistant", "content": f"Plot generated successfully. See 'Generated Plot'."})
215
 
216
  yield agent_thoughts, final_answer_chat, generated_code, execution_output, generated_plot_path
217
 
@@ -263,7 +269,8 @@ def create_interface():
263
  final_answer_chat = gr.Chatbot(
264
  label="Analysis Results",
265
  height=300,
266
- show_copy_button=True
 
267
  )
268
 
269
  with gr.TabItem("Agent Thoughts"):
 
157
  return # Exit the generator
158
 
159
  # Format for Gradio Chatbot (list of dictionaries for type='messages')
160
+ final_answer_chat = [
161
+ {"role": "user", "content": user_query},
162
+ {"role": "assistant", "content": "Code generation complete. See the 'Generated Code' box. Attempting to execute code..."}
163
+ ]
164
  yield agent_thoughts, final_answer_chat, generated_code, execution_output, generated_plot_path
165
 
166
  # --- Execute the generated code ---
 
212
  execution_output = "No code was generated to execute."
213
 
214
  # Update final answer chat to reflect execution attempt
215
+ final_answer_chat = [
216
+ {"role": "user", "content": user_query},
217
+ {"role": "assistant", "content": "Code execution finished. See 'Execution Output'."}
218
+ ]
219
  if generated_plot_path:
220
+ final_answer_chat.append({"role": "assistant", "content": "Plot generated successfully. See 'Generated Plot'."})
221
 
222
  yield agent_thoughts, final_answer_chat, generated_code, execution_output, generated_plot_path
223
 
 
269
  final_answer_chat = gr.Chatbot(
270
  label="Analysis Results",
271
  height=300,
272
+ show_copy_button=True,
273
+ type="messages" # Explicitly set to use OpenAI-style message format
274
  )
275
 
276
  with gr.TabItem("Agent Thoughts"):