JohnAlexander23 commited on
Commit
76f7219
1 Parent(s): 3866cff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -88,9 +88,17 @@ user_input = st.text_input("Enter your question here:")
88
 
89
  # Button to trigger response
90
  if st.button("Get Response"):
91
- # Fetch and display response
92
- response = fetch_response(user_input)
93
- st.write("Response:", response)
 
 
 
 
 
 
 
 
94
 
95
  # Footer
96
  st.markdown(
@@ -103,3 +111,4 @@ st.markdown(
103
  )
104
 
105
 
 
 
88
 
89
  # Button to trigger response
90
  if st.button("Get Response"):
91
+ if user_input:
92
+ # Fetch and display response
93
+ response = fetch_response(user_input)
94
+ st.session_state.chat_history.append({"role": "user", "content": user_input})
95
+ st.session_state.chat_history.append({"role": "assistant", "content": response})
96
+
97
+ # Display new chat history without refreshing
98
+ st.experimental_rerun()
99
+
100
+ # Display input field at the end
101
+ st.text_input("Enter your question here:", key="input")
102
 
103
  # Footer
104
  st.markdown(
 
111
  )
112
 
113
 
114
+