Skip to content

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

fix: preserve raptor tree titles (#17772)

buua436bccbd7492cb9
diff --git a/rag/advanced_rag/knowlege_compile/raptor.py b/rag/advanced_rag/knowlege_compile/raptor.py
index 48723a6844..587eb1f24b 100644
--- a/rag/advanced_rag/knowlege_compile/raptor.py
+++ b/rag/advanced_rag/knowlege_compile/raptor.py
@@ -231,12 +231,14 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:
"",
cnt,
)
+ cnt = str(cnt or "").strip()
logging.debug(f"SUM: {cnt}")
self._check_task_canceled(task_id, "before embedding")
embds = await self._embedding_encode(cnt)
- return cnt.split("\n")[0], cnt, embds
+ title = cnt.splitlines()[0].strip() if cnt else ""
+ return title, cnt, embds
except TaskCanceledException:
raise
except Exception as exc: