Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -189,6 +189,8 @@ with st.form(key="chat_form", clear_on_submit=True):
|
|
| 189 |
user_message = st.text_area("Enter your message (e.g., request modifications)", height=100)
|
| 190 |
submit_chat = st.form_submit_button("Send")
|
| 191 |
|
|
|
|
|
|
|
| 192 |
if submit_chat and user_message.strip():
|
| 193 |
# Append the new user message to chat history.
|
| 194 |
st.session_state.chat_history.append({"role": "user", "content": user_message})
|
|
@@ -208,5 +210,8 @@ if submit_chat and user_message.strip():
|
|
| 208 |
except Exception as e:
|
| 209 |
st.error(f"An error occurred while calling the API: {e}")
|
| 210 |
|
| 211 |
-
#
|
| 212 |
-
st
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
user_message = st.text_area("Enter your message (e.g., request modifications)", height=100)
|
| 190 |
submit_chat = st.form_submit_button("Send")
|
| 191 |
|
| 192 |
+
# ... (previous code remains unchanged)
|
| 193 |
+
|
| 194 |
if submit_chat and user_message.strip():
|
| 195 |
# Append the new user message to chat history.
|
| 196 |
st.session_state.chat_history.append({"role": "user", "content": user_message})
|
|
|
|
| 210 |
except Exception as e:
|
| 211 |
st.error(f"An error occurred while calling the API: {e}")
|
| 212 |
|
| 213 |
+
# Conditionally rerun if available, otherwise inform the user.
|
| 214 |
+
if hasattr(st, "experimental_rerun"):
|
| 215 |
+
st.experimental_rerun()
|
| 216 |
+
else:
|
| 217 |
+
st.info("Please refresh the page to see the updated conversation.")
|