Skip to content

Commit 62de535

Browse files
authored
Fix Bug: When performing the dify_retrieval, the metadata of the document was empty. (infiniflow#7968)
### What problem does this PR solve? When performing the dify_retrieval, the metadata of the document was empty. ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue)
1 parent f087956 commit 62de535

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

api/apps/sdk/dify_retrieval.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from flask import request, jsonify
1717

1818
from api.db import LLMType
19+
from api.db.services.document_service import DocumentService
1920
from api.db.services.knowledgebase_service import KnowledgebaseService
2021
from api.db.services.llm_service import LLMBundle
2122
from api import settings
@@ -70,12 +71,13 @@ def retrieval(tenant_id):
7071

7172
records = []
7273
for c in ranks["chunks"]:
74+
e, doc = DocumentService.get_by_id( c["doc_id"])
7375
c.pop("vector", None)
7476
records.append({
7577
"content": c["content_with_weight"],
7678
"score": c["similarity"],
7779
"title": c["docnm_kwd"],
78-
"metadata": {}
80+
"metadata": doc.meta_fields
7981
})
8082

8183
return jsonify({"records": records})

0 commit comments

Comments
 (0)