JayZeeDesign / researcher-gpt

448 stars 253 forks source link

Turn this into a chat #12

Open Sophon-0 opened 11 months ago

Sophon-0 commented 11 months ago

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:")

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.