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.

Update metadata_service.py (#23272)

XiaoXiaoJiangYunb2c8718f3581
diff --git a/api/services/metadata_service.py b/api/services/metadata_service.py
index 59a30040e8c..2a83588f419 100644
--- a/api/services/metadata_service.py
+++ b/api/services/metadata_service.py
@@ -143,7 +143,6 @@ class MetadataService:
lock_key = f"dataset_metadata_lock_{dataset.id}"
try:
MetadataService.knowledge_base_metadata_lock_check(dataset.id, None)
- dataset.built_in_field_enabled = True
db.session.add(dataset)
documents = DocumentService.get_working_documents_by_dataset_id(dataset.id)
if documents:
@@ -159,6 +158,7 @@ class MetadataService:
doc_metadata[BuiltInField.source.value] = MetadataDataSource[document.data_source_type].value
document.doc_metadata = doc_metadata
db.session.add(document)
+ dataset.built_in_field_enabled = True
db.session.commit()
except Exception:
logging.exception("Enable built-in field failed")
@@ -172,7 +172,6 @@ class MetadataService:
lock_key = f"dataset_metadata_lock_{dataset.id}"
try:
MetadataService.knowledge_base_metadata_lock_check(dataset.id, None)
- dataset.built_in_field_enabled = False
db.session.add(dataset)
documents = DocumentService.get_working_documents_by_dataset_id(dataset.id)
document_ids = []
@@ -190,6 +189,7 @@ class MetadataService:
document.doc_metadata = doc_metadata
db.session.add(document)
document_ids.append(document.id)
+ dataset.built_in_field_enabled = False
db.session.commit()
except Exception:
logging.exception("Disable built-in field failed")