Skip to content

Commit

Permalink
Merge pull request #328 from editor-syntax/patch-3
Browse files Browse the repository at this point in the history
fix: streamlit_chat_app.py
  • Loading branch information
xtekky committed May 1, 2023
2 parents 56a8f9f + 08f53b3 commit 0817c93
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gui/streamlit_chat_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def exit_handler():
)
submit_button = st.button("Submit")


if (user_input and user_input != st.session_state['input_text']) or submit_button:
output = query(user_input, st.session_state['query_method'])

Expand All @@ -84,6 +83,7 @@ def exit_handler():
st.session_state.current_conversation['generated_responses'].append(escaped_output)
save_conversations(st.session_state.conversations, st.session_state.current_conversation)
st.session_state['input_text'] = ''
st.session_state['input_field_key'] += 1 # Increment key value for new widget
user_input = input_placeholder.text_input(
'You:', value=st.session_state['input_text'], key=f'input_text_{st.session_state["input_field_key"]}'
) # Clear the input field
Expand All @@ -92,9 +92,8 @@ def exit_handler():
if st.sidebar.button("New Conversation"):
st.session_state['selected_conversation'] = None
st.session_state['current_conversation'] = {'user_inputs': [], 'generated_responses': []}
st.session_state['input_field_key'] += 1

st.session_state['query_method'] = st.sidebar.selectbox("Select API:", options=avail_query_methods, index=0)
st.session_state['input_field_key'] += 1 # Increment key value for new widget
st.session_state['query_method'] = st.sidebar.selectbox("Select API:", options=avail_query_methods, index=0)

# Proxy
st.session_state['proxy'] = st.sidebar.text_input("Proxy: ")
Expand Down

0 comments on commit 0817c93

Please sign in to comment.