IAMTFRMZA commited on
Commit
2b8b374
·
verified ·
1 Parent(s): f2f6c9f
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -11,11 +11,6 @@ st.caption("Chat with an Ai Assistant on your Pathology Queries")
11
  with st.sidebar:
12
  OPENAI_API_KEY = st.text_input("Enter your C2 Group of Technologies Access Key", type="password")
13
 
14
- # Clear chat button
15
- if st.sidebar.button("Clear Chat"):
16
- st.session_state.messages = []
17
- st.rerun()
18
-
19
  if OPENAI_API_KEY:
20
  client = OpenAI(api_key=OPENAI_API_KEY)
21
  else:
@@ -28,6 +23,11 @@ ASSISTANT_ID = "asst_Iu6cCU4CyugmAD2yPgktyivH"
28
  if "messages" not in st.session_state:
29
  st.session_state["messages"] = []
30
 
 
 
 
 
 
31
  # Display chat history
32
  for message in st.session_state.messages:
33
  role, content = message["role"], message["content"]
 
11
  with st.sidebar:
12
  OPENAI_API_KEY = st.text_input("Enter your C2 Group of Technologies Access Key", type="password")
13
 
 
 
 
 
 
14
  if OPENAI_API_KEY:
15
  client = OpenAI(api_key=OPENAI_API_KEY)
16
  else:
 
23
  if "messages" not in st.session_state:
24
  st.session_state["messages"] = []
25
 
26
+ # Clear chat button above chat input
27
+ if st.button("Clear Chat", use_container_width=True):
28
+ st.session_state.messages = []
29
+ st.rerun()
30
+
31
  # Display chat history
32
  for message in st.session_state.messages:
33
  role, content = message["role"], message["content"]