neuralleap commited on
Commit
facfb6b
·
verified ·
1 Parent(s): 7fec67a

Update chat history

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -5,7 +5,6 @@ import os
5
  import uuid
6
  from datetime import datetime
7
  import time
8
- import random
9
 
10
  # Load environment variables
11
  load_dotenv()
@@ -17,7 +16,7 @@ st.set_page_config(
17
  layout="wide"
18
  )
19
 
20
- # Initialize session state
21
  if "conversations" not in st.session_state:
22
  st.session_state.conversations = {}
23
 
@@ -164,6 +163,18 @@ with st.sidebar:
164
 
165
  st.markdown("---")
166
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  # Main chat window
168
  with st.container():
169
  current_id = st.session_state.current_conversation_id
 
5
  import uuid
6
  from datetime import datetime
7
  import time
 
8
 
9
  # Load environment variables
10
  load_dotenv()
 
16
  layout="wide"
17
  )
18
 
19
+ # Initialize session state for conversations and history
20
  if "conversations" not in st.session_state:
21
  st.session_state.conversations = {}
22
 
 
163
 
164
  st.markdown("---")
165
 
166
+ # Chat History Section
167
+ st.markdown("### Chat History")
168
+ for conv_id, conv_data in st.session_state.conversations.items():
169
+ if st.button(conv_data["title"], key=f"hist_{conv_id}"):
170
+ st.session_state.current_conversation_id = conv_id
171
+ st.rerun()
172
+
173
+ # New Chat Button
174
+ if st.button("+ New Chat"):
175
+ create_new_chat()
176
+ st.rerun()
177
+
178
  # Main chat window
179
  with st.container():
180
  current_id = st.session_state.current_conversation_id