From d84d674986c3f803e58f6aae0438cba64ad947f4 Mon Sep 17 00:00:00 2001 From: Dhravya <63950637+Dhravya@users.noreply.github.com> Date: Sat, 27 Jun 2026 02:20:46 +0000 Subject: [PATCH] Address chat source annotation review nits --- apps/web/components/chat/message/agent-message.tsx | 14 ++++++++------ apps/web/lib/chat-memory-tools.ts | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/web/components/chat/message/agent-message.tsx b/apps/web/components/chat/message/agent-message.tsx index 035e8bb1..f3f0697e 100644 --- a/apps/web/components/chat/message/agent-message.tsx +++ b/apps/web/components/chat/message/agent-message.tsx @@ -303,12 +303,14 @@ function makeMarkdownComponents( return { a: ({ href, children }: { href?: string; children?: ReactNode }) => { if (href?.startsWith("#sm-source:")) { - let sourceId = "" - try { - sourceId = decodeURIComponent(href.slice("#sm-source:".length)) - } catch { - return <>{children} - } + const sourceId = (() => { + try { + return decodeURIComponent(href.slice("#sm-source:".length)) + } catch { + return null + } + })() + if (!sourceId) return <>{children} return (