Skip to content

Commit 6ccb113

Browse files
authored
fix(agent-ui): reset streamed text at generation boundaries in agent chat (#10664)
One agent turn runs several internal LLM generations (tool selection, reasoning, final answer) that all emit stream_event deltas over the same per-agent SSE channel. The chat page accumulated every 'content' delta into a single live bubble and ignored the 'done' boundary events, so the internal generations' text (e.g. the English tool-selection rationale) merged with — and visually corrupted — the streamed final answer. Reset the accumulated content/reasoning on 'done': each generation gets a clean live bubble, and the authoritative full answer still arrives via the final json_message event as before. Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
1 parent 3f8806b commit 6ccb113

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

core/http/react-ui/src/pages/AgentChat.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,14 @@ export default function AgentChat() {
221221
return updated
222222
})
223223
} else if (data.type === 'done') {
224-
// Content will be finalized by json_message event
224+
// One agent turn runs several internal LLM generations (tool
225+
// selection, reasoning, final answer) over the same SSE channel;
226+
// 'done' marks the boundary between them. Reset the accumulated
227+
// text so an internal generation's output doesn't merge into the
228+
// next one's bubble — the final json_message carries the
229+
// authoritative full answer anyway.
230+
setStreamContent('')
231+
setStreamReasoning('')
225232
}
226233
} catch (_err) {
227234
// ignore

0 commit comments

Comments
 (0)