From a42c14892f24d1efde2eafcfc3f2427fad9c3ea5 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:26:53 -0500 Subject: [PATCH] perf: streaming a reply in a long chat no longer rescans every message for artifacts with full regex passes (#35209) --- src/lib/components/chat/Chat.svelte | 2 +- src/lib/utils/index.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index cc5eae73f5..e77e119e4e 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -3041,7 +3041,7 @@ if (message?.role !== 'user') { const messageContent = getOutputText(message?.output) || removeAllDetails(message?.content ?? ''); - if (!messageContent.trim()) { + if (!messageContent.includes('```') && !messageContent.includes('<')) { return; } diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index fab228187c..1c5652e968 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -1146,6 +1146,7 @@ export const removeDetails = (content, types) => { }; export const removeAllDetails = (content) => { + if (!/
]*>[\s\S]*?<\/details>/gi, ''); // Second pass: catch any remaining blocks that live outside code fences