Skip to content

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

Fix: metadata update issue (#12815)

Kevin Hue20d56a34ce4
diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py
index 41a528ddaf..b0527c6464 100644
--- a/api/db/services/document_service.py
+++ b/api/db/services/document_service.py
@@ -675,8 +675,7 @@ class DocumentService(CommonService):
if k not in old:
old[k] = v
continue
- if isinstance(v, dict):
- assert isinstance(old[k], dict)
+ if isinstance(v, dict) and isinstance(old[k], dict):
dfs_update(old[k], v)
else:
old[k] = v
@@ -863,11 +862,9 @@ class DocumentService(CommonService):
key = upd.get("key")
if not key:
continue
- if key not in meta:
- meta[key] = upd.get("value")
new_value = upd.get("value")
- match_provided = "match" in upd
+ match_provided = upd.get("match")
if key not in meta:
if match_provided:
continue
@@ -880,7 +877,7 @@ class DocumentService(CommonService):
if isinstance(new_value, list):
meta[key] = dedupe_list(new_value)
else:
- meta[key] = new_value
+ meta[key].append(new_value)
changed = True
else:
match_value = upd.get("match")