Spaces:
Sleeping
Sleeping
Update pages/machine_learning.py
Browse files
pages/machine_learning.py
CHANGED
|
@@ -45,8 +45,10 @@ deep_seek = ChatHuggingFace(
|
|
| 45 |
)
|
| 46 |
|
| 47 |
# --- Session State ---
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# --- Chat Form ---
|
| 52 |
with st.form(key="chat_form"):
|
|
@@ -65,11 +67,11 @@ if submit and user_input:
|
|
| 65 |
result = deep_seek.invoke(messages)
|
| 66 |
|
| 67 |
# Append to history
|
| 68 |
-
st.session_state.
|
| 69 |
|
| 70 |
# --- Display Chat History ---
|
| 71 |
st.subheader("🗨️ Chat History")
|
| 72 |
-
for
|
| 73 |
st.markdown(f"**You:** {user}")
|
| 74 |
st.markdown(f"**Mentor:** {bot}")
|
| 75 |
st.markdown("---")
|
|
|
|
| 45 |
)
|
| 46 |
|
| 47 |
# --- Session State ---
|
| 48 |
+
PAGE_KEY = "machine_learning_chat_history"
|
| 49 |
+
# --- Session State ---
|
| 50 |
+
if PAGE_KEY not in st.session_state:
|
| 51 |
+
st.session_state[PAGE_KEY] = []
|
| 52 |
|
| 53 |
# --- Chat Form ---
|
| 54 |
with st.form(key="chat_form"):
|
|
|
|
| 67 |
result = deep_seek.invoke(messages)
|
| 68 |
|
| 69 |
# Append to history
|
| 70 |
+
st.session_state[PAGE_KEY].append((user_input, result.content))
|
| 71 |
|
| 72 |
# --- Display Chat History ---
|
| 73 |
st.subheader("🗨️ Chat History")
|
| 74 |
+
for user, bot in st.session_state[PAGE_KEY]:
|
| 75 |
st.markdown(f"**You:** {user}")
|
| 76 |
st.markdown(f"**Mentor:** {bot}")
|
| 77 |
st.markdown("---")
|