fix: stabilize streamed message rendering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-23 23:49:12 +01:00
co-authored by Copilot
parent 8caa2d2eb4
commit 082af36255
9 changed files with 81 additions and 15 deletions
+10 -2
View File
@@ -609,18 +609,24 @@ export class EryxAppService extends EventEmitter<AppServiceEvents> {
sessionId: string,
event: TurnDeltaEvent,
): Promise<void> {
if (event.content === undefined && event.contentDelta === undefined) {
return;
}
const session = this.requireSession(workspace, sessionId);
const existing = session.messages.find((message) => message.id === event.messageId);
if (existing) {
existing.content = mergeStreamingText(existing.content, event.contentDelta);
existing.content =
event.content ?? mergeStreamingText(existing.content, event.contentDelta);
existing.pending = true;
existing.authorName = event.authorName;
} else {
session.messages.push({
id: event.messageId,
role: 'assistant',
authorName: event.authorName,
content: event.contentDelta,
content: event.content ?? event.contentDelta,
createdAt: nowIso(),
pending: true,
});
@@ -636,6 +642,7 @@ export class EryxAppService extends EventEmitter<AppServiceEvents> {
messageId: event.messageId,
authorName: event.authorName,
contentDelta: event.contentDelta,
content: event.content,
});
}
@@ -697,6 +704,7 @@ export class EryxAppService extends EventEmitter<AppServiceEvents> {
occurredAt: nowIso(),
messageId: message.id,
authorName: message.authorName,
content: message.content,
});
this.emitCompletedActivity(sessionId, pattern, message);