Skip to content

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

fix(api): return empty documents when doc_ids filter is empty (#19809)

Jin Hai34723377be81
diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py
index 8dfc706085..7073dd3d25 100644
--- a/api/db/services/document_service.py
+++ b/api/db/services/document_service.py
@@ -150,6 +150,8 @@ class DocumentService(CommonService):
.where(cls.model.kb_id == kb_id)
)
if doc_ids is not None:
+ if len(doc_ids) == 0:
+ return [], 0
docs = docs.where(cls.model.id.in_(doc_ids))
if run_status:
docs = docs.where(cls.model.run.in_(run_status))