Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -633,12 +633,12 @@ Available: {match.get('Available', 'N/A')}"""
|
|
| 633 |
|
| 634 |
# --- Update Chat History for Gradio ---
|
| 635 |
# Append the user's original message and the final bot response to the history state
|
| 636 |
-
chat_history = chat_history + [(original_user_input, final_response)]
|
| 637 |
|
| 638 |
# Optional: Manage history length
|
| 639 |
-
max_history_pairs = 10 # Keep last 10 turns (20 messages total)
|
| 640 |
-
if len(chat_history) > max_history_pairs:
|
| 641 |
-
|
| 642 |
# print(f"History truncated. Keeping last {len(chat_history)} turns.") # Debug print
|
| 643 |
|
| 644 |
# Return the updated history state
|
|
|
|
| 633 |
|
| 634 |
# --- Update Chat History for Gradio ---
|
| 635 |
# Append the user's original message and the final bot response to the history state
|
| 636 |
+
chat_history = chat_history + [(original_user_input, final_response)]
|
| 637 |
|
| 638 |
# Optional: Manage history length
|
| 639 |
+
max_history_pairs = 10 # Keep last 10 turns (20 messages total)
|
| 640 |
+
if len(chat_history) > max_history_pairs:
|
| 641 |
+
chat_history = chat_history[-max_history_pairs:]
|
| 642 |
# print(f"History truncated. Keeping last {len(chat_history)} turns.") # Debug print
|
| 643 |
|
| 644 |
# Return the updated history state
|