Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,8 @@ def groq_with_memory(message: str, topic: str = "general", summarize: bool = Fal
|
|
| 40 |
# Limit history to max_history messages to avoid token overflow
|
| 41 |
recent_history = chat_history[-max_history:]
|
| 42 |
|
| 43 |
-
# Prepare messages for API call
|
| 44 |
-
messages = recent_history
|
| 45 |
|
| 46 |
if summarize:
|
| 47 |
# Create a prompt to summarize the conversation
|
|
|
|
| 40 |
# Limit history to max_history messages to avoid token overflow
|
| 41 |
recent_history = chat_history[-max_history:]
|
| 42 |
|
| 43 |
+
# Prepare messages for API call, excluding timestamp and topic
|
| 44 |
+
messages = [{"role": msg["role"], "content": msg["content"]} for msg in recent_history]
|
| 45 |
|
| 46 |
if summarize:
|
| 47 |
# Create a prompt to summarize the conversation
|