mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 18:03:29 +08:00
fix: stabilize knowledge compilation navigation updates (#17345)
This commit is contained in:
@@ -492,6 +492,20 @@ class DocumentService(CommonService):
|
||||
except Exception as e:
|
||||
logging.warning(f"Failed to delete thumbnail for document {doc.id}: {e}")
|
||||
|
||||
# Prune this doc's line from the KB's tree-kind navigation before the
|
||||
# broad doc_id delete below removes the nav_doc row needed to locate
|
||||
# and update its parent cluster.
|
||||
try:
|
||||
from rag.advanced_rag.knowlege_compile.dataset_nav import (
|
||||
remove_dataset_nav_doc_sync,
|
||||
)
|
||||
|
||||
remove_dataset_nav_doc_sync(tenant_id, doc.kb_id, doc.id)
|
||||
except Exception as e:
|
||||
logging.warning(
|
||||
f"Failed to prune dataset_nav for document {doc.id}: {e}",
|
||||
)
|
||||
|
||||
# Delete chunks from doc store - this is critical, log errors
|
||||
try:
|
||||
settings.docStoreConn.delete({"doc_id": doc.id}, chunk_index_name, doc.kb_id)
|
||||
@@ -507,20 +521,6 @@ class DocumentService(CommonService):
|
||||
except Exception as e:
|
||||
logging.warning(f"Failed to clean up artifact products for document {doc.id}: {e}")
|
||||
|
||||
# Prune this doc's line from the KB's tree-kind navigation
|
||||
# markdown (best-effort — the markdown is a downstream artifact,
|
||||
# and failure here must not block the document delete).
|
||||
try:
|
||||
from rag.advanced_rag.knowlege_compile.dataset_nav import (
|
||||
remove_dataset_nav_doc_sync,
|
||||
)
|
||||
|
||||
remove_dataset_nav_doc_sync(tenant_id, doc.kb_id, doc.id)
|
||||
except Exception as e:
|
||||
logging.warning(
|
||||
f"Failed to prune dataset_nav for document {doc.id}: {e}",
|
||||
)
|
||||
|
||||
# Delete document metadata (non-critical, log and continue)
|
||||
try:
|
||||
DocMetadataService.delete_document_metadata(doc.id, doc.kb_id, tenant_id)
|
||||
|
||||
Reference in New Issue
Block a user