mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-30 09:57:57 -04:00
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>
This commit is contained in:
@@ -221,7 +221,14 @@ export default function AgentChat() {
|
||||
return updated
|
||||
})
|
||||
} else if (data.type === 'done') {
|
||||
// Content will be finalized by json_message event
|
||||
// One agent turn runs several internal LLM generations (tool
|
||||
// selection, reasoning, final answer) over the same SSE channel;
|
||||
// 'done' marks the boundary between them. Reset the accumulated
|
||||
// text so an internal generation's output doesn't merge into the
|
||||
// next one's bubble — the final json_message carries the
|
||||
// authoritative full answer anyway.
|
||||
setStreamContent('')
|
||||
setStreamReasoning('')
|
||||
}
|
||||
} catch (_err) {
|
||||
// ignore
|
||||
|
||||
Reference in New Issue
Block a user