Clone77 commited on
Commit
3ec7462
·
verified ·
1 Parent(s): f241341

Update pages/python.py

Browse files
Files changed (1) hide show
  1. pages/python.py +5 -4
pages/python.py CHANGED
@@ -45,9 +45,10 @@ deep_seek = ChatHuggingFace(
45
  )
46
 
47
  # --- Session State ---
48
- if "chat_history" not in st.session_state:
49
- st.session_state.chat_history = []
50
-
 
51
  # --- Chat Form ---
52
  with st.form(key="chat_form"):
53
  user_input = st.text_input("Ask your question:")
@@ -69,7 +70,7 @@ if submit and user_input:
69
 
70
  # --- Display Chat History ---
71
  st.subheader("🗨️ Chat History")
72
- for i, (user, bot) in enumerate(st.session_state.chat_history):
73
  st.markdown(f"**You:** {user}")
74
  st.markdown(f"**Mentor:** {bot}")
75
  st.markdown("---")
 
45
  )
46
 
47
  # --- Session State ---
48
+ PAGE_KEY = "python_chat_history"
49
+ # --- Session State ---
50
+ if PAGE_KEY not in st.session_state:
51
+ st.session_state[PAGE_KEY] = []
52
  # --- Chat Form ---
53
  with st.form(key="chat_form"):
54
  user_input = st.text_input("Ask your question:")
 
70
 
71
  # --- Display Chat History ---
72
  st.subheader("🗨️ Chat History")
73
+ for user, bot in st.session_state[PAGE_KEY]:
74
  st.markdown(f"**You:** {user}")
75
  st.markdown(f"**Mentor:** {bot}")
76
  st.markdown("---")