Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(ui): fall back to chunk_id lookup when reference chunk index misses (#20288)

chanx90767771f37a
diff --git a/web/src/components/floating-chat-widget-markdown.tsx b/web/src/components/floating-chat-widget-markdown.tsx
index ae6a839cf6..585c59d951 100644
--- a/web/src/components/floating-chat-widget-markdown.tsx
+++ b/web/src/components/floating-chat-widget-markdown.tsx
@@ -139,7 +139,12 @@ const FloatingChatWidgetMarkdown = ({
const getReferenceInfo = useCallback(
(chunkIndex: number) => {
- const chunkItem = reference?.chunks?.[chunkIndex];
+ let chunkItem = reference?.chunks?.[chunkIndex];
+ if (!chunkItem) {
+ chunkItem = reference?.chunks?.find(
+ (x: any) => x?.chunk_id === chunkIndex,
+ ) as IReferenceChunk;
+ }
if (!chunkItem) return null;
const docAggsArray = Array.isArray(reference?.doc_aggs)
? reference.doc_aggs