fix: stabilize streamed agent text

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-21 21:39:46 +01:00
co-authored by Copilot
parent 039e570348
commit 16229b8b0a
7 changed files with 232 additions and 3 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import type { SessionEventRecord } from '@shared/domain/event';
import type { ChatMessageRecord, SessionRecord } from '@shared/domain/session';
import type { WorkspaceState } from '@shared/domain/workspace';
import { mergeStreamingText } from '@shared/utils/streamingText';
export function applySessionEventWorkspace(
current: WorkspaceState | undefined,
@@ -86,7 +87,7 @@ function applyMessageDeltaEvent(session: SessionRecord, event: SessionEventRecor
const nextMessage: ChatMessageRecord = {
...existing,
authorName: event.authorName ?? existing.authorName,
content: `${existing.content}${event.contentDelta}`,
content: mergeStreamingText(existing.content, event.contentDelta),
pending: true,
};