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