Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: remove document from dataset error when vector index npe (#489)

John Wangda04ff040b06
diff --git a/api/tasks/remove_document_from_index_task.py b/api/tasks/remove_document_from_index_task.py
index 81e8367b53a..1635d38bad2 100644
--- a/api/tasks/remove_document_from_index_task.py
+++ b/api/tasks/remove_document_from_index_task.py
@@ -41,7 +41,8 @@ def remove_document_from_index_task(document_id: str):
kw_index = IndexBuilder.get_index(dataset, 'economy')
# delete from vector index
- vector_index.delete_by_document_id(document.id)
+ if vector_index:
+ vector_index.delete_by_document_id(document.id)
# delete from keyword index
segments = db.session.query(DocumentSegment).filter(DocumentSegment.document_id == document.id).all()