Skip to content

Commit

Permalink
button to clear chat data
Browse files Browse the repository at this point in the history
  • Loading branch information
ruoccofabrizio committed Apr 3, 2023
1 parent d63130c commit d2f321b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/pages/00_Chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
from streamlit_chat import message
from utilities.helper import LLMHelper

def clear_chat_data():
st.session_state['input'] = ""
st.session_state['chat_history'] = []
st.session_state['source_documents'] = []

# Initialize chat history
if 'chat_history' not in st.session_state:
st.session_state['chat_history'] = []
Expand All @@ -12,6 +17,7 @@

# Chat
input_text = st.text_input("You: ", placeholder="type your question", key="input")
clear_chat = st.button("Clear chat", key="clear_chat", on_click=clear_chat_data)

if input_text:
question = input_text
Expand Down

0 comments on commit d2f321b

Please sign in to comment.