From e267fe7df47434a5553aafd13f5f40f888421cd2 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Sat, 21 Feb 2026 12:32:27 -0800 Subject: [PATCH] web: export stream parser and add user-message event type --- apps/web/app/components/chat-panel.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/web/app/components/chat-panel.tsx b/apps/web/app/components/chat-panel.tsx index 48cf2393be8..326b390aff1 100644 --- a/apps/web/app/components/chat-panel.tsx +++ b/apps/web/app/components/chat-panel.tsx @@ -296,6 +296,7 @@ function AttachmentStrip({ type ParsedPart = | { type: "text"; text: string } + | { type: "user-message"; id?: string; text: string } | { type: "reasoning"; text: string; state?: string } | { type: "dynamic-tool"; @@ -306,7 +307,7 @@ type ParsedPart = output?: Record; }; -function createStreamParser() { +export function createStreamParser() { const parts: ParsedPart[] = []; let currentTextIdx = -1; let currentReasoningIdx = -1; @@ -315,6 +316,15 @@ function createStreamParser() { const t = event.type as string; switch (t) { + case "user-message": + currentTextIdx = -1; + currentReasoningIdx = -1; + parts.push({ + type: "user-message", + id: event.id as string | undefined, + text: (event.text as string) ?? "", + }); + break; case "reasoning-start": parts.push({ type: "reasoning",