Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: streamlit_chat_app.py #328

Merged
merged 1 commit into from
May 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update streamlit_chat_app.py
  • Loading branch information
pleaseful committed May 1, 2023
commit 08f53b336158d0da44ed7c6e0d6ec2d01ab509a9
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