tdurzynski commited on
Commit
9d0a3d7
·
verified ·
1 Parent(s): bea540e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -157,8 +157,14 @@ def orchestrate_workflow(image, nutritionix_key):
157
  max_turns=10
158
  )
159
 
160
- # Extract and format the final response from the chat
161
- result = response[-1].get("content", "No output from agents.")
 
 
 
 
 
 
162
  if isinstance(result, dict):
163
  result = result.get("text", "No text output from agents.")
164
  print(f"Total time: {time.time() - start:.2f}s")
 
157
  max_turns=10
158
  )
159
 
160
+ # Extract and format the final response from the ChatResult
161
+ if hasattr(response, 'chat_history') and response.chat_history:
162
+ # Get the last message from chat history
163
+ last_message = response.chat_history[-1]
164
+ result = last_message.get("content", "No output from agents.")
165
+ else:
166
+ result = "No output from agents."
167
+
168
  if isinstance(result, dict):
169
  result = result.get("text", "No text output from agents.")
170
  print(f"Total time: {time.time() - start:.2f}s")