response_container = st.container()
container = st.container()
with container:
unique_keys = [str(uuid.uuid4())[:8] for _ in range(4)]
user_input_key = f'input_{unique_keys[0]}'
my_form_key = f'my_form_{unique_keys[1]}'
with st.form(key=my_form_key, clear_on_submit=True):
user_input = st.text_input("Query:", placeholder="Talk to your data here (:", key=user_input_key)
st.write(user_input)
submit_button = st.form_submit_button(label='Send')
if submit_button and user_input:
output = conversational_chat(user_input)
st.write("History:", st.session_state.get('history'))
st.write("Generated:", st.session_state.get('generated'))
if st.session_state['generated']:
with response_container:
for i in range(min(len(st.session_state['generated']), len(st.session_state['past']))):
message(st.session_state["past"][i], is_user=True, key=str(i) + '_user', avatar_style="personas")
message(st.session_state["generated"][i], key=str(i), avatar_style="bottts")
Your keys are random and that is wrong in this case. You should maintain a fix key so that the issues you are experiencing will be avoided.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.