Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -157,8 +157,14 @@ def orchestrate_workflow(image, nutritionix_key):
|
|
157 |
max_turns=10
|
158 |
)
|
159 |
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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")
|