fix(artifacts): only render citation badges for links in citationMap

Same fix as message-list-item: project URLs and regular links in
artifact file preview should be rendered as plain links, not badges.
Only actual citations (in citationMap) should be rendered as badges.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ruitanglin
2026-02-06 15:55:53 +08:00
parent 1ce154fa71
commit 365e3f4304

View File

@@ -313,7 +313,7 @@ export function ArtifactFilePreview({
return <span>{children}</span>; return <span>{children}</span>;
} }
// Check if it's a citation link // Only render as CitationLink badge if it's a citation (in citationMap)
const citation = citationMap.get(href); const citation = citationMap.get(href);
if (citation) { if (citation) {
return ( return (
@@ -323,19 +323,14 @@ export function ArtifactFilePreview({
); );
} }
// Check if it's an external link (http/https) // All other links (including project URLs) render as plain links
const isExternalLink =
href.startsWith("http://") || href.startsWith("https://");
if (isExternalLink) {
return ( return (
<CitationLink href={href}>{children}</CitationLink> <a
); href={href}
} target="_blank"
rel="noopener noreferrer"
// Internal/anchor link className="text-primary underline underline-offset-2 hover:no-underline"
return ( >
<a href={href} className="text-primary hover:underline">
{children} {children}
</a> </a>
); );