From 767c44dec36b85f20a210abd530672ed62c7cdbf Mon Sep 17 00:00:00 2001 From: Ferran Pons Serra Date: Tue, 19 May 2026 16:48:18 +0200 Subject: [PATCH] fix: consolidate streaming thought partials into single bubble 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 #443 --- src/app/components/chat/chat.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/components/chat/chat.component.ts b/src/app/components/chat/chat.component.ts index e7625387..7820e9f6 100644 --- a/src/app/components/chat/chat.component.ts +++ b/src/app/components/chat/chat.component.ts @@ -1272,7 +1272,11 @@ export class ChatComponent implements OnInit, AfterViewInit, OnDestroy { if (existingIndex >= 0) { const existingEvent = events[existingIndex]; - + + if (uiEvent.thought && existingEvent.thought) { + uiEvent.text = (existingEvent.text || '') + (uiEvent.text || ''); + } + // Preserve functionResponses and functionCalls if not present in new event if (!uiEvent.functionResponses || uiEvent.functionResponses.length === 0) { uiEvent.functionResponses = existingEvent.functionResponses;