From 982dac47ecdc850620411968560008456b6a164a Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Tue, 13 Jan 2026 09:21:54 +0200 Subject: [PATCH] fix: support Chinese brackets in citation regex --- surfsense_web/components/assistant-ui/markdown-text.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/surfsense_web/components/assistant-ui/markdown-text.tsx b/surfsense_web/components/assistant-ui/markdown-text.tsx index a910b5739..d5e7eeab4 100644 --- a/surfsense_web/components/assistant-ui/markdown-text.tsx +++ b/surfsense_web/components/assistant-ui/markdown-text.tsx @@ -16,7 +16,8 @@ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button import { cn } from "@/lib/utils"; // Citation pattern: [citation:CHUNK_ID] or [citation:doc-CHUNK_ID] -const CITATION_REGEX = /\[citation:(doc-)?(\d+)\]/g; +// Also matches Chinese brackets 【】 as LLM sometimes uses them +const CITATION_REGEX = /[\[【]citation:(doc-)?(\d+)[\]】]/g; // Track chunk IDs to citation numbers mapping for consistent numbering // This map is reset when a new message starts rendering