global agent # Let the function know we're using the global version of agent
i = 0
continue_chat = True
while continue_chat:
if i > 0:
query = st.text_input("", key=f'text_input_{i}')
else:
query = st.text_input("What would you like to ask about ?", key=f'text_input_{i}')
if query:
result = agent({"input": query})
st.info(result['output'])
st.download_button('Download result', result['output'])
# add another query here so we can continue to ask questions
i += 1
else:
continue_chat = False
`
when I start this app, I type a question and get an answer. But when I continue the chat by typing a second question, they answer my first question again before answering the second question. So every time I type a new question, all previous get answered again.
hello Jason I tried to turn this into a chat:
` def main(): st.set_page_config(page_title="search", page_icon=":eagle:") st.header("search :eagle:")
`
when I start this app, I type a question and get an answer. But when I continue the chat by typing a second question, they answer my first question again before answering the second question. So every time I type a new question, all previous get answered again.