mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-25 19:28:23 +00:00
fix(citations): use markdown link text as fallback for display
When citation data is not available, use the markdown link text (children) as display text instead of just the domain. This ensures that links like [OpenJudge](github.com/...) show 'OpenJudge' instead of just 'github.com'. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b46a19e116
commit
c87f176fac
@ -310,10 +310,14 @@ export const CitationLink = ({
|
||||
}: 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;
|
||||
// Priority: citation.title > children (if meaningful) > domain
|
||||
// - citation.title: from parsed <citations> block, most accurate
|
||||
// - children: from markdown link text [Text](url), used when no citation data
|
||||
// - domain: fallback when both above are unavailable
|
||||
// Skip children if it's a generic placeholder like "Source"
|
||||
const childrenText = typeof children === "string" ? children : null;
|
||||
const isGenericText = childrenText === "Source" || childrenText === "来源";
|
||||
const displayText = citation?.title || (!isGenericText && childrenText) || domain;
|
||||
|
||||
return (
|
||||
<InlineCitationCard>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user