Skip to content

Fix: show feedback on first assistant message in e2e-chatbot-app#226

Open
noramxiao wants to merge 1 commit into
mainfrom
fix/streamlit-first-message-feedback
Open

Fix: show feedback on first assistant message in e2e-chatbot-app#226
noramxiao wants to merge 1 commit into
mainfrom
fix/streamlit-first-message-feedback

Conversation

@noramxiao
Copy link
Copy Markdown

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), and AssistantResponse.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 via render_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.session_state.history.append(assistant_response)
st.rerun()

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 after query_endpoint_and_render() returns.

Fixes #42

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
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

Successfully merging this pull request may close these issues.

In e2e-chatbot-app template the first message does not show feedback option until one more request is made

1 participant