Skip to content

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

fix: add toc field to extractor output (#16059)

buua4365751a2244437
diff --git a/rag/flow/extractor/extractor.py b/rag/flow/extractor/extractor.py
index 8061086a74..07de5d2f6e 100644
--- a/rag/flow/extractor/extractor.py
+++ b/rag/flow/extractor/extractor.py
@@ -62,6 +62,7 @@ class Extractor(ProcessBase, LLM):
if toc:
d = deepcopy(docs[-1])
d["doc_id"] = self._canvas._doc_id
+ d["toc"] = json.dumps(toc, ensure_ascii=False)
d["content_with_weight"] = json.dumps(toc, ensure_ascii=False)
d["toc_kwd"] = "toc"
d["available_int"] = 0
@@ -108,4 +109,3 @@ class Extractor(ProcessBase, LLM):
msg.insert(0, {"role": "system", "content": sys_prompt})
self.set_output("chunks", [{self._param.field_name: await self._generate_async(msg)}])
-