Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -3
src/streamlit_app.py
CHANGED
|
@@ -30,9 +30,12 @@ model_choice = st.sidebar.selectbox("Choose a model", [
|
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
-
if st.sidebar.button("🧹 Clear Chat"):
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# ==== Session Initialization ====
|
| 38 |
if "messages" not in st.session_state:
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
+
# if st.sidebar.button("🧹 Clear Chat"):
|
| 34 |
+
# st.session_state.messages = []
|
| 35 |
+
# st.rerun()
|
| 36 |
+
if st.sidebar.button("🧹 Clear Chat", key="clear_chat"):
|
| 37 |
+
st.session_state.messages = [] # Reset chat history
|
| 38 |
+
st.experimental_rerun() # Force a rerun (works better in Spaces)
|
| 39 |
|
| 40 |
# ==== Session Initialization ====
|
| 41 |
if "messages" not in st.session_state:
|