summaryrefslogtreecommitdiffstats
path: root/gui/streamlit_chat_app.py
diff options
context:
space:
mode:
authormache102 <91365155+mache102@users.noreply.github.com>2023-05-01 16:58:57 +0200
committerGitHub <noreply@github.com>2023-05-01 16:58:57 +0200
commitb59535129643b2988c16413e0f66bef5c7713a34 (patch)
treebec2815e11225ae3f07c9a6ed6a8d091953406ff /gui/streamlit_chat_app.py
parentfix index display for search (diff)
parentMerge pull request #332 from mache102/main (diff)
downloadgpt4free-b59535129643b2988c16413e0f66bef5c7713a34.tar
gpt4free-b59535129643b2988c16413e0f66bef5c7713a34.tar.gz
gpt4free-b59535129643b2988c16413e0f66bef5c7713a34.tar.bz2
gpt4free-b59535129643b2988c16413e0f66bef5c7713a34.tar.lz
gpt4free-b59535129643b2988c16413e0f66bef5c7713a34.tar.xz
gpt4free-b59535129643b2988c16413e0f66bef5c7713a34.tar.zst
gpt4free-b59535129643b2988c16413e0f66bef5c7713a34.zip
Diffstat (limited to 'gui/streamlit_chat_app.py')
-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 f80afa80..99e8428c 100644
--- a/gui/streamlit_chat_app.py
+++ b/gui/streamlit_chat_app.py
@@ -78,7 +78,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'])
@@ -88,6 +87,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
@@ -96,9 +96,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: ")