Spaces:
Sleeping
Sleeping
Fix chat message format to be compatible with Gradio 4.19.2
Browse files- src/app.py +3 -5
src/app.py
CHANGED
|
@@ -27,17 +27,15 @@ class DryingApp:
|
|
| 27 |
# Get response from agent
|
| 28 |
messages, processed_image = self.agent.process_message(message, image)
|
| 29 |
|
| 30 |
-
# Update history with proper message format
|
| 31 |
if not history:
|
| 32 |
history = []
|
| 33 |
|
| 34 |
# Safely extract the assistant's response
|
| 35 |
assistant_response = messages[1]["content"] if len(messages) > 1 else "I apologize, but I couldn't process your message."
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
{"role": "assistant", "content": assistant_response}
|
| 40 |
-
])
|
| 41 |
|
| 42 |
return history, processed_image
|
| 43 |
except Exception as e:
|
|
|
|
| 27 |
# Get response from agent
|
| 28 |
messages, processed_image = self.agent.process_message(message, image)
|
| 29 |
|
| 30 |
+
# Update history with proper message format for Gradio 4.19.2
|
| 31 |
if not history:
|
| 32 |
history = []
|
| 33 |
|
| 34 |
# Safely extract the assistant's response
|
| 35 |
assistant_response = messages[1]["content"] if len(messages) > 1 else "I apologize, but I couldn't process your message."
|
| 36 |
|
| 37 |
+
# Format as tuples (user_message, assistant_message) for Gradio 4.19.2 compatibility
|
| 38 |
+
history.append((message, assistant_response))
|
|
|
|
|
|
|
| 39 |
|
| 40 |
return history, processed_image
|
| 41 |
except Exception as e:
|