Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,15 +28,11 @@ def respond(message, history):
|
|
| 28 |
|
| 29 |
Args:
|
| 30 |
message: The user's current message
|
| 31 |
-
history: List of previous conversation messages (in ChatInterface format)
|
| 32 |
"""
|
| 33 |
-
# Build messages from history
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
# History from gr.ChatInterface comes as list of dicts with 'role' and 'content'
|
| 37 |
-
if history:
|
| 38 |
-
for msg in history:
|
| 39 |
-
messages.append({"role": msg["role"], "content": msg["content"]})
|
| 40 |
|
| 41 |
# Add current message
|
| 42 |
messages.append({"role": "user", "content": message})
|
|
|
|
| 28 |
|
| 29 |
Args:
|
| 30 |
message: The user's current message
|
| 31 |
+
history: List of previous conversation messages (in ChatInterface messages format)
|
| 32 |
"""
|
| 33 |
+
# Build messages from history
|
| 34 |
+
# gr.ChatInterface with type="messages" passes history directly as a list of message dicts
|
| 35 |
+
messages = history if history else []
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Add current message
|
| 38 |
messages.append({"role": "user", "content": message})
|