fix(citations): improve citation link rendering and copy behavior

- Use citation.title for display text in CitationLink to ensure correct
  titles show during streaming (instead of generic "Source" text)
- Render all external links as CitationLink badges for consistent styling
  during streaming output
- Add removeAllCitations when copying message content to clipboard
- Simplify citations_format prompt for cleaner AI output

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ruitanglin
2026-02-04 16:34:12 +08:00
parent 1e2675beb3
commit 0f9e3d508b
3 changed files with 26 additions and 26 deletions

View File

@@ -309,6 +309,11 @@ export const CitationLink = ({
children,
}: CitationLinkProps) => {
const domain = extractDomainFromUrl(href);
// Priority: citation.title > domain
// When citation has title, use it for consistent display
// This ensures correct title shows even during streaming when children might be generic
const displayText = citation?.title || domain;
return (
<InlineCitationCard>
@@ -324,7 +329,7 @@ export const CitationLink = ({
variant="secondary"
className="hover:bg-secondary/80 mx-0.5 cursor-pointer gap-1 rounded-full px-2 py-0.5 text-xs font-normal"
>
{children ?? domain}
{displayText}
<ExternalLinkIcon className="size-3" />
</Badge>
</a>