Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,8 +85,9 @@ def get_response(system_message, chat_history, user_text, max_new_tokens=800):
|
|
| 85 |
response = "I'm sorry, but I couldn't generate a response. Can you rephrase your question?"
|
| 86 |
|
| 87 |
# ✅ Preserve conversation history
|
| 88 |
-
|
| 89 |
-
|
|
|
|
| 90 |
|
| 91 |
return response, st.session_state.chat_history
|
| 92 |
|
|
|
|
| 85 |
response = "I'm sorry, but I couldn't generate a response. Can you rephrase your question?"
|
| 86 |
|
| 87 |
# ✅ Preserve conversation history
|
| 88 |
+
chat_history.append({'role': 'user', 'content': user_text})
|
| 89 |
+
chat_history.append({'role': 'assistant', 'content': response})
|
| 90 |
+
st.session_state.chat_history = chat_history # ✅ Update session state history
|
| 91 |
|
| 92 |
return response, st.session_state.chat_history
|
| 93 |
|