Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How the response from ChatGPT is written in the UI? #7

Open
smith-co opened this issue Jun 12, 2023 · 0 comments
Open

How the response from ChatGPT is written in the UI? #7

smith-co opened this issue Jun 12, 2023 · 0 comments

Comments

@smith-co
Copy link

I see you have an input field with a callback process_input:

st.text_input("Message", key="user_input", disabled=not is_openai_api_key_set(), on_change=process_input)

This callback process_input is:

def process_input():
    if st.session_state["user_input"] and len(st.session_state["user_input"].strip()) > 0:
        user_text = st.session_state["user_input"].strip()
        with st.session_state["thinking_spinner"], st.spinner(f"Thinking"):
            query_text = st.session_state["pdfquery"].ask(user_text)

        st.session_state["messages"].append((user_text, True))
        st.session_state["messages"].append((query_text, False))

Here you are only writing the response from the model into the st.session_state["messages"]. How the response is getting written the to the UI?

Will appreciate if you can please add an explanation. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant