From bcbbf9cf3fdb0626c978a994ec158eb785314ef9 Mon Sep 17 00:00:00 2001 From: ruitanglin Date: Fri, 6 Feb 2026 14:28:28 +0800 Subject: [PATCH] fix(citations): only render CitationLink badges for AI messages Human messages should display links as plain underlined text, not as citation badges. This preserves the original user input appearance when users paste URLs in their messages. Co-authored-by: Cursor --- .../workspace/messages/message-list-item.tsx | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/workspace/messages/message-list-item.tsx b/frontend/src/components/workspace/messages/message-list-item.tsx index 6336e0f..c69dc10 100644 --- a/frontend/src/components/workspace/messages/message-list-item.tsx +++ b/frontend/src/components/workspace/messages/message-list-item.tsx @@ -77,24 +77,40 @@ export function MessageListItem({ /** * Custom link component that handles citations and external links - * All external links (http/https) are rendered as CitationLink badges - * to ensure consistent styling during streaming + * For AI messages: external links (http/https) are rendered as CitationLink badges + * For human messages: links are rendered as plain text/links */ function MessageLink({ href, children, citationMap, + isHuman, }: React.AnchorHTMLAttributes & { citationMap: Map; + isHuman: boolean; }) { if (!href) return {children}; + // Human messages: render links as plain underlined text + if (isHuman) { + return ( + + {children} + + ); + } + const citation = citationMap.get(href); // Check if it's an external link (http/https) const isExternalLink = href.startsWith("http://") || href.startsWith("https://"); - // All external links use CitationLink for consistent styling during streaming + // AI messages: external links use CitationLink for consistent styling during streaming if (isExternalLink) { return ( @@ -198,7 +214,7 @@ function MessageContent_({ // Shared markdown components const markdownComponents = useMemo(() => ({ a: (props: React.AnchorHTMLAttributes) => ( - + ), img: (props: React.ImgHTMLAttributes) => (