ZunairaHawwar commited on
Commit
109b610
Β·
verified Β·
1 Parent(s): 8b942d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -288,8 +288,11 @@ class LangChainRAGSystem:
288
  }
289
 
290
  def reset_conversation(self):
291
- """Reset the conversation memory."""
292
  self.memory.clear()
 
 
 
293
  st.success("πŸ”„ Conversation history cleared!")
294
 
295
  # Initialize the RAG system
@@ -325,6 +328,7 @@ def main():
325
 
326
  if st.button("πŸ—‘οΈ Clear Conversation"):
327
  rag_system.reset_conversation()
 
328
 
329
  st.markdown("---")
330
  st.subheader("πŸ“Š System Info")
 
288
  }
289
 
290
  def reset_conversation(self):
291
+ """Reset the conversation memory and UI chat history."""
292
  self.memory.clear()
293
+ # Also clear Streamlit session state messages
294
+ if "messages" in st.session_state:
295
+ st.session_state.messages = []
296
  st.success("πŸ”„ Conversation history cleared!")
297
 
298
  # Initialize the RAG system
 
328
 
329
  if st.button("πŸ—‘οΈ Clear Conversation"):
330
  rag_system.reset_conversation()
331
+ st.rerun() # Force UI refresh
332
 
333
  st.markdown("---")
334
  st.subheader("πŸ“Š System Info")