fix: consistent citation numbering during streaming

This commit is contained in:
CREDO23
2026-01-13 09:09:53 +02:00
parent cd3677b5fa
commit 5e31a228bc
2 changed files with 2 additions and 5 deletions
@@ -81,7 +81,8 @@ def format_mentioned_surfsense_docs_as_context(
context_parts = ["<mentioned_surfsense_docs>"]
context_parts.append(
"The user has explicitly mentioned the following SurfSense documentation pages. "
"These are official documentation about how to use SurfSense and should be used to answer questions about the application."
"These are official documentation about how to use SurfSense and should be used to answer questions about the application. "
"Use [citation:CHUNK_ID] format for citations (e.g., [citation:doc-123])."
)
for doc in documents:
@@ -90,10 +90,6 @@ function parseTextWithCitations(text: string): ReactNode[] {
}
const MarkdownTextImpl = () => {
// Reset citation counter at the start of each render
// This ensures consistent numbering as the message streams in
resetCitationCounter();
return (
<MarkdownTextPrimitive
remarkPlugins={[remarkGfm]}