Fix: show feedback on first assistant message in e2e-chatbot-app#226
Open
noramxiao wants to merge 1 commit into
Open
Fix: show feedback on first assistant message in e2e-chatbot-app#226noramxiao wants to merge 1 commit into
noramxiao wants to merge 1 commit into
Conversation
Chat history (including the feedback widget rendered by AssistantResponse) is drawn at the top of the script, but a new response is appended to history *after* that loop and streamed inline without feedback. Streamlit doesn't rerun on its own, so the feedback control was missing on the first message until the next request triggered a rerun. Call st.rerun() after appending the response so it re-renders through the history loop with feedback attached. Fixes #42 Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the Streamlit
e2e-chatbot-app, the thumbs up/down feedback widget doesn't appear on the first assistant message until another request is sent (reported in #42).Why: chat history is rendered at the top of the script (
app.py:101-103), andAssistantResponse.render()is what attaches the feedback widget (messages.py:58-59). But a new response is appended to history after that loop (app.py:336) and streamed inline viarender_message()only — which has no feedback. Streamlit doesn't rerun on its own after the input handler, so the feedback control for the new message isn't drawn until the next user interaction triggers a rerun.Fix
st.rerun()after appending re-renders the new response through the history loop, which attaches feedback immediately. Applies to all three task types since it's afterquery_endpoint_and_render()returns.Fixes #42