mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-21 21:24:46 +08:00
fix: hide incomplete citations block during streaming
Improve UX by hiding citations block while it's being streamed: - Remove complete citations blocks (existing logic) - Also remove incomplete citations blocks during streaming - Prevents flickering of raw citations XML in the UI Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -67,9 +67,15 @@ export function parseCitations(content: string): ParseCitationsResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove ALL citations blocks from content
|
// Remove ALL citations blocks from content (both complete and incomplete)
|
||||||
cleanContent = content.replace(/<citations>[\s\S]*?<\/citations>/g, "").trim();
|
cleanContent = content.replace(/<citations>[\s\S]*?<\/citations>/g, "").trim();
|
||||||
|
|
||||||
|
// Also remove incomplete citations blocks (during streaming)
|
||||||
|
// Match <citations> without closing tag or <citations> followed by anything until end of string
|
||||||
|
if (cleanContent.includes("<citations>")) {
|
||||||
|
cleanContent = cleanContent.replace(/<citations>[\s\S]*$/g, "").trim();
|
||||||
|
}
|
||||||
|
|
||||||
return { citations, cleanContent };
|
return { citations, cleanContent };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user