Sharal commited on
Commit
cf27813
·
verified ·
1 Parent(s): 446abed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -181,14 +181,17 @@ def main():
181
 
182
  if submit_button:
183
  with st.spinner("Generating response..."):
184
- # Call the conversation function inside the form
185
- qa_chain, chat_history, response_answer, sources = conversation(st.session_state['qa_chain'], message, st.session_state['chat_history'])
 
 
186
  st.session_state['qa_chain'] = qa_chain
187
  st.session_state['chat_history'] = chat_history
188
  st.session_state['sources'] = sources
189
 
190
- # Instead of clearing `st.session_state['message_input']`, use Streamlit's `st.empty()`
191
- st.empty() # This clears the form input
 
192
 
193
  if __name__ == "__main__":
194
  main()
 
181
 
182
  if submit_button:
183
  with st.spinner("Generating response..."):
184
+ # Process the form input
185
+ qa_chain, chat_history, response_answer, sources = conversation(
186
+ st.session_state['qa_chain'], message, st.session_state['chat_history']
187
+ )
188
  st.session_state['qa_chain'] = qa_chain
189
  st.session_state['chat_history'] = chat_history
190
  st.session_state['sources'] = sources
191
 
192
+ # Clear the form input field by simply not including the key update
193
+ # The form input should be handled directly in the form submit button
194
+ st.experimental_rerun()
195
 
196
  if __name__ == "__main__":
197
  main()