summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
author– sanz <sanzbernward@gmail.com>2023-05-01 03:10:38 +0200
committerGitHub <noreply@github.com>2023-05-01 03:10:38 +0200
commit08f53b336158d0da44ed7c6e0d6ec2d01ab509a9 (patch)
treea311e4885630db54fa1450a0632bc0fcd96dc985 /gui
parentUpdate README.md (diff)
downloadgpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.tar
gpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.tar.gz
gpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.tar.bz2
gpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.tar.lz
gpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.tar.xz
gpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.tar.zst
gpt4free-08f53b336158d0da44ed7c6e0d6ec2d01ab509a9.zip
Diffstat (limited to '')
-rw-r--r--gui/streamlit_chat_app.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/gui/streamlit_chat_app.py b/gui/streamlit_chat_app.py
index 6abc9caf..bca4b954 100644
--- a/gui/streamlit_chat_app.py
+++ b/gui/streamlit_chat_app.py
@@ -74,7 +74,6 @@ user_input = input_placeholder.text_input(
)
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'])
@@ -84,6 +83,7 @@ if (user_input and user_input != st.session_state['input_text']) or submit_butto
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
@@ -92,9 +92,8 @@ if (user_input and user_input != st.session_state['input_text']) or submit_butto
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: ")