SaileshSivan commited on
Commit
9c3d936
·
1 Parent(s): a472d44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -44,7 +44,7 @@ chat = ChatOpenAI(temperature=0.1)
44
 
45
  if 'flowmessages' not in st.session_state:
46
  st.session_state['flowmessages'] = [
47
- SystemMessage(content="""You are a AI Doctor assistant and Your name is Doctor AI.\
48
  Sailesh developed you on December 6, 2023.
49
 
50
  You will perform the following tasks:
@@ -118,7 +118,6 @@ with st.form(key='my_form',clear_on_submit=True):
118
  # If the "Submit" button is clicked
119
  if submit:
120
 
121
-
122
  # Display loading message while processing
123
  with st.spinner("Analyzing..."):
124
  st.header(":blue[You]", divider=True)
@@ -128,7 +127,11 @@ if submit:
128
  response = get_chatmodel_response(input_question)
129
 
130
  if response is not None:
131
-
132
- st.write(response)
 
 
 
 
133
  else:
134
- st.subheader("Error: Unable to get response. Please try again later.")
 
44
 
45
  if 'flowmessages' not in st.session_state:
46
  st.session_state['flowmessages'] = [
47
+ SystemMessage(content="""You are Doctor AI. an AI Doctor assistant.\
48
  Sailesh developed you on December 6, 2023.
49
 
50
  You will perform the following tasks:
 
118
  # If the "Submit" button is clicked
119
  if submit:
120
 
 
121
  # Display loading message while processing
122
  with st.spinner("Analyzing..."):
123
  st.header(":blue[You]", divider=True)
 
127
  response = get_chatmodel_response(input_question)
128
 
129
  if response is not None:
130
+ # Display assistant response in chat message container
131
+ with st.chat_message("assistant"):
132
+ st.chat_message(response)
133
+
134
+ # Add assistant response to chat history
135
+ st.session_state.messages.append({"role": "assistant", "content": response})
136
  else:
137
+ st.subheader("Error: Unable to get response. Please try again later.")