SaileshSivan commited on
Commit
3437930
·
1 Parent(s): c503b4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -85,11 +85,10 @@ if 'flowmessages' not in st.session_state:
85
  """)
86
 
87
  ]
88
- with st.container():
89
- # Create an empty space at the top
90
- top_space = st.empty()
91
 
92
- # Display conversation history below the empty space
 
 
93
  for message in reversed(st.session_state["flowmessages"]):
94
  if isinstance(message, AIMessage):
95
  st.header("Doctor AI", divider=True)
@@ -98,7 +97,9 @@ with st.container():
98
  st.header(":blue[You]", divider=True)
99
  st.write(message.content)
100
 
101
- # Input box and form at the bottom
 
 
102
  with st.form(key="my_form", clear_on_submit=True):
103
  input_question = st.text_input("Type here.")
104
  submit = st.form_submit_button("Ask Doctor AI")
@@ -109,7 +110,7 @@ with st.container():
109
  response = get_chatmodel_response(input_question)
110
 
111
  if response is not None:
112
- # Display conversation history
113
  for message in reversed(st.session_state["flowmessages"]):
114
  if isinstance(message, AIMessage):
115
  st.header("Doctor AI", divider=True)
@@ -117,7 +118,5 @@ with st.container():
117
  elif isinstance(message, HumanMessage):
118
  st.header(":blue[You]", divider=True)
119
  st.write(message.content)
120
- # Scroll to the bottom to show the latest input
121
- top_space.markdown("<br>", unsafe_allow_html=True)
122
  else:
123
  st.subheader("Error: Unable to get response. Please try again later.")
 
85
  """)
86
 
87
  ]
 
 
 
88
 
89
+ # Display conversation history in sidebar
90
+ with st.sidebar:
91
+ st.title("Chat History")
92
  for message in reversed(st.session_state["flowmessages"]):
93
  if isinstance(message, AIMessage):
94
  st.header("Doctor AI", divider=True)
 
97
  st.header(":blue[You]", divider=True)
98
  st.write(message.content)
99
 
100
+ # Main container for input form
101
+ with st.container():
102
+ # Input form at the bottom
103
  with st.form(key="my_form", clear_on_submit=True):
104
  input_question = st.text_input("Type here.")
105
  submit = st.form_submit_button("Ask Doctor AI")
 
110
  response = get_chatmodel_response(input_question)
111
 
112
  if response is not None:
113
+ # Display conversation history in main container
114
  for message in reversed(st.session_state["flowmessages"]):
115
  if isinstance(message, AIMessage):
116
  st.header("Doctor AI", divider=True)
 
118
  elif isinstance(message, HumanMessage):
119
  st.header(":blue[You]", divider=True)
120
  st.write(message.content)
 
 
121
  else:
122
  st.subheader("Error: Unable to get response. Please try again later.")