Léo Bourrel commited on
Commit
3560824
·
1 Parent(s): c885074

feat: add button to reset conversation

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -77,6 +77,12 @@ def on_click_callback():
77
  # insert_chat_history_articles(conn, history_id, llm_response["source_documents"])
78
 
79
 
 
 
 
 
 
 
80
  load_css()
81
  initialize_session_state()
82
 
@@ -119,6 +125,8 @@ with chat_column:
119
  on_click=on_click_callback,
120
  )
121
 
 
 
122
  information_placeholder.caption(
123
  f"""
124
  Used {st.session_state.token_count} tokens \n
 
77
  # insert_chat_history_articles(conn, history_id, llm_response["source_documents"])
78
 
79
 
80
+ def clear_history():
81
+ st.session_state.history.clear()
82
+ st.session_state.token_count = 0
83
+ st.session_state.conversation.memory.clear()
84
+
85
+
86
  load_css()
87
  initialize_session_state()
88
 
 
125
  on_click=on_click_callback,
126
  )
127
 
128
+ st.button("New conversation", on_click=clear_history)
129
+
130
  information_placeholder.caption(
131
  f"""
132
  Used {st.session_state.token_count} tokens \n