abanm commited on
Commit
216feba
·
verified ·
1 Parent(s): a3cd83d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -60,11 +60,21 @@ def get_saved_sessions():
60
 
61
  # Sidebar Configuration
62
  with st.sidebar:
 
 
 
 
 
 
 
 
 
 
 
63
  dubs_key = st.text_input("Enter Dubs Key", key="chatbot_api_key", type="password")
64
  saved_sessions = get_saved_sessions()
65
 
66
 
67
-
68
  # Display saved sessions
69
  if saved_sessions:
70
  selected_session = st.radio("Past Sessions:", saved_sessions)
@@ -75,15 +85,7 @@ with st.sidebar:
75
  else:
76
  st.write("No past sessions available.")
77
 
78
- # Reset chat
79
- if st.button("Reset Chat"):
80
- st.session_state["messages"] = [
81
- {"role": "system", "content": "You are DUBS, a helpful assistant capable of conversing in a friendly and knowledgeable way."},
82
- {"role": "assistant", "content": "Hello! How can I assist you today?"}
83
- ]
84
- st.session_state["session_name"] = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
85
- save_chat_history(st.session_state["session_name"], st.session_state["messages"])
86
- st.success("Chat reset and new session started.")
87
 
88
  # Chat History Initialization
89
  if "messages" not in st.session_state:
 
60
 
61
  # Sidebar Configuration
62
  with st.sidebar:
63
+
64
+ # Reset chat
65
+ if st.button("New Chat"):
66
+ st.session_state["messages"] = [
67
+ {"role": "system", "content": "You are DUBS, a helpful assistant capable of conversing in a friendly and knowledgeable way."},
68
+ {"role": "assistant", "content": "Hello! How can I assist you today?"}
69
+ ]
70
+ st.session_state["session_name"] = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
71
+ save_chat_history(st.session_state["session_name"], st.session_state["messages"])
72
+ st.success("Chat reset and new session started.")
73
+
74
  dubs_key = st.text_input("Enter Dubs Key", key="chatbot_api_key", type="password")
75
  saved_sessions = get_saved_sessions()
76
 
77
 
 
78
  # Display saved sessions
79
  if saved_sessions:
80
  selected_session = st.radio("Past Sessions:", saved_sessions)
 
85
  else:
86
  st.write("No past sessions available.")
87
 
88
+
 
 
 
 
 
 
 
 
89
 
90
  # Chat History Initialization
91
  if "messages" not in st.session_state: