Mpavan45 commited on
Commit
395a950
·
verified ·
1 Parent(s): cfb6b98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -101,7 +101,6 @@ with chat_container:
101
  # User input at the bottom
102
  user_input = st.text_input("Type your message here:", key="user_message")
103
 
104
- # If user submits a message
105
  if user_input:
106
  # Save user message
107
  save_message(session_id, "user", user_input)
@@ -116,10 +115,10 @@ if user_input:
116
  st.session_state.messages.append(("assistant", response))
117
 
118
  # Display AI response
119
- with chat_container:
120
- with st.chat_message("assistant"):
121
- st.markdown(response)
122
 
123
- # Clear the input field after message submission
124
  st.session_state.pop("user_message")
 
125
  st.rerun() # Refresh the app
 
101
  # User input at the bottom
102
  user_input = st.text_input("Type your message here:", key="user_message")
103
 
 
104
  if user_input:
105
  # Save user message
106
  save_message(session_id, "user", user_input)
 
115
  st.session_state.messages.append(("assistant", response))
116
 
117
  # Display AI response
118
+ with st.chat_message("assistant"):
119
+ st.markdown(response)
 
120
 
121
+ #Clear input field
122
  st.session_state.pop("user_message")
123
+ st.session_state["user_message"] = ""
124
  st.rerun() # Refresh the app