fix: consolidate streaming thought partials into single bubble#444
Open
ferponse wants to merge 1 commit into
Open
fix: consolidate streaming thought partials into single bubble#444ferponse wants to merge 1 commit into
ferponse wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
When thought chunks arrive via SSE streaming, each partial ReasoningChunk was rendered as a separate Thought bubble instead of being accumulated into one. The consolidation logic found the existing partial thought event but replaced it without preserving the accumulated text. Prepend the existing thought text before replacing so consecutive thought partials merge into a single progressively-growing bubble, matching the behavior of regular text streaming. Fixes google#443
a94ba79 to
767c44d
Compare
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.
Summary
When thought/reasoning chunks arrive via SSE streaming (e.g., Claude extended thinking, Gemini with
thinking_config), each partialReasoningChunkrenders as a separate "Thought" bubble in the Dev UI instead of consolidating into one.The consolidation logic in
chat.component.tscorrectly locates the existing partial thought event (lines ~1246/1255), butbuildUiEventFromEventcreates a freshUiEventwith only the current chunk's text. On replacement (line 1285), the previously accumulated text is lost.Fix
Before replacing the existing thought event, prepend the existing thought text to the new event's text. This makes consecutive thought partials merge into a single progressively-growing bubble — matching the behavior of regular text streaming.
Testing
ng test --no-watch --browsers=ChromeHeadless)vertex_ai/claude-sonnet-4-6via LiteLLM withthinking={"type": "enabled", "budget_tokens": 10000}Fixes #443