Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -99,7 +99,7 @@ with chat_container:
|
|
| 99 |
st.markdown(content)
|
| 100 |
|
| 101 |
# User input stays at the bottom
|
| 102 |
-
user_input = st.text_input("Type your message here:",
|
| 103 |
|
| 104 |
if user_input:
|
| 105 |
save_message(session_id, "user", user_input)
|
|
@@ -112,10 +112,10 @@ if user_input:
|
|
| 112 |
save_message(session_id, "assistant", response)
|
| 113 |
st.session_state.messages.append(("assistant", response))
|
| 114 |
|
| 115 |
-
# Refresh
|
| 116 |
with chat_container:
|
| 117 |
with st.chat_message("assistant"):
|
| 118 |
st.markdown(response)
|
| 119 |
|
| 120 |
-
# Clear input field
|
| 121 |
-
st.session_state.
|
|
|
|
| 99 |
st.markdown(content)
|
| 100 |
|
| 101 |
# User input stays at the bottom
|
| 102 |
+
user_input = st.text_input("Type your message here:", key="user_message")
|
| 103 |
|
| 104 |
if user_input:
|
| 105 |
save_message(session_id, "user", user_input)
|
|
|
|
| 112 |
save_message(session_id, "assistant", response)
|
| 113 |
st.session_state.messages.append(("assistant", response))
|
| 114 |
|
| 115 |
+
# Refresh chat UI
|
| 116 |
with chat_container:
|
| 117 |
with st.chat_message("assistant"):
|
| 118 |
st.markdown(response)
|
| 119 |
|
| 120 |
+
# Clear input field after message submission
|
| 121 |
+
st.session_state.pop("user_message")
|