Skip to content

Commit

Permalink
Merge pull request #58 from polywrap/namesty/clear-history-on-newrun
Browse files Browse the repository at this point in the history
Clear history on new runs
  • Loading branch information
namesty authored Mar 13, 2024
2 parents f68b7ba + afa2da8 commit 77624f8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion evo_prophet/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,24 @@ def research(
st.title("Evo Prophet")
st.write('Ask any question about a future outcome')

if "clear_history" not in st.session_state:
st.session_state['clear_history'] = False

if "question" not in st.session_state:
st.session_state['question'] = None

with st.sidebar:
openai_api_key = SecretStr(st.text_input("OpenAI API Key", type="password", key="open_ai_key"))

if question := st.chat_input(placeholder='Will Twitter implement a new misinformation policy before the end of 2024?'):
if question := st.chat_input(placeholder='Will Twitter implement a new misinformation policy before the end of 2024?') or st.session_state['question']:
st.session_state['question'] = question

if st.session_state['clear_history']:
st.session_state['clear_history'] = False
st.rerun()
else:
st.session_state['clear_history'] = True

st.chat_message("user").write(question)

with st.chat_message("assistant"):
Expand Down

0 comments on commit 77624f8

Please sign in to comment.