Update app.py
Browse files
app.py
CHANGED
|
@@ -2486,10 +2486,10 @@ if problem and problem != st.session_state.last_submitted:
|
|
| 2486 |
answer = ask_ai_streaming(problem, sympy_result, st.session_state.messages)
|
| 2487 |
plot_graph(problem, sympy_result)
|
| 2488 |
|
|
|
|
| 2489 |
# Save to history
|
|
|
|
|
|
|
| 2490 |
st.session_state.messages.append({"role": "user", "content": problem})
|
| 2491 |
st.session_state.messages.append({"role": "assistant", "content": answer})
|
| 2492 |
-
# Auto-save to chat history
|
| 2493 |
-
if not st.session_state.current_chat_id:
|
| 2494 |
-
new_chat()
|
| 2495 |
save_current_chat()
|
|
|
|
| 2486 |
answer = ask_ai_streaming(problem, sympy_result, st.session_state.messages)
|
| 2487 |
plot_graph(problem, sympy_result)
|
| 2488 |
|
| 2489 |
+
|
| 2490 |
# Save to history
|
| 2491 |
+
if not st.session_state.current_chat_id:
|
| 2492 |
+
new_chat() # create chat ID BEFORE appending messages
|
| 2493 |
st.session_state.messages.append({"role": "user", "content": problem})
|
| 2494 |
st.session_state.messages.append({"role": "assistant", "content": answer})
|
|
|
|
|
|
|
|
|
|
| 2495 |
save_current_chat()
|