From 27c5fa5381efc28a582941c8078814ac7fc3d7ea Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Mon, 4 May 2026 11:58:26 -0500 Subject: [PATCH] chore: uptick --- apps/desktop/src/lib/chat-messages.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/lib/chat-messages.ts b/apps/desktop/src/lib/chat-messages.ts index 1877e88c080..f8a9f41c6a6 100644 --- a/apps/desktop/src/lib/chat-messages.ts +++ b/apps/desktop/src/lib/chat-messages.ts @@ -53,7 +53,7 @@ export function reasoningPart(text: string): ChatMessagePart { } const MEDIA_LINE_RE = - /(^|\n)[\t ]*[`"']?MEDIA:\s*(?`[^`\n]+`|"[^"\n]+"|'[^'\n]+'|\S+)[`"']?[\t ]*(?:\n|$)/g + /(^|\n)[\t ]*[`"']?MEDIA:\s*(?`[^`\n]+`|"[^"\n]+"|'[^'\n]+'|\S+)[`"']?[\t ]*(\n|$)/g const MEDIA_TAG_RE = /[`"']?MEDIA:\s*(?`[^`\n]+`|"[^"\n]+"|'[^'\n]+'|\S+)[`"']?/g @@ -72,11 +72,13 @@ function mediaLink(value: string): string { export function renderMediaTags(text: string): string { return text - .replace(MEDIA_LINE_RE, (_match, lead: string, value: string) => `${lead}${mediaLink(value)}\n`) + .replace( + MEDIA_LINE_RE, + (_match, lead: string, value: string, trailer: string) => `${lead}${mediaLink(value)}${trailer}` + ) .replace(MEDIA_TAG_RE, (_match, value: string) => mediaLink(value)) .replace(/[ \t]+\n/g, '\n') .replace(/\n{3,}/g, '\n\n') - .trim() } export function assistantTextPart(text: string): ChatMessagePart {