Skip to content

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

Add support for folder deletion (#3635)

liuhuad8b150a34ca0
diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py
index 523d13876c..6ab62d8245 100644
--- a/api/apps/kb_app.py
+++ b/api/apps/kb_app.py
@@ -162,6 +162,7 @@ def rm():
message="Database error (Document removal)!")
f2d = File2DocumentService.get_by_document_id(doc.id)
FileService.filter_delete([File.source_type == FileSource.KNOWLEDGEBASE, File.id == f2d[0].file_id])
+ FileService.filter_delete([File.source_type == FileSource.KNOWLEDGEBASE, File.type == "folder", File.name == kbs[0].name])
File2DocumentService.delete_by_document_id(doc.id)
if not KnowledgebaseService.delete_by_id(req["kb_id"]):
diff --git a/api/apps/sdk/dataset.py b/api/apps/sdk/dataset.py
index 61cc3dd848..0dffdf292f 100644
--- a/api/apps/sdk/dataset.py
+++ b/api/apps/sdk/dataset.py
@@ -252,6 +252,8 @@ def delete(tenant_id):
File.id == f2d[0].file_id,
]
)
+ FileService.filter_delete(
+ [File.source_type == FileSource.KNOWLEDGEBASE, File.type == "folder", File.name == kbs[0].name])
File2DocumentService.delete_by_document_id(doc.id)
if not KnowledgebaseService.delete_by_id(id):
return get_error_data_result(message="Delete dataset error.(Database error)")