mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-30 07:55:13 +08:00
Fix Bug: When performing the dify_retrieval, the metadata of the document was empty. (#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)
This commit is contained in:
parent
f0879563d0
commit
62de535ac8
@ -16,6 +16,7 @@
|
|||||||
from flask import request, jsonify
|
from flask import request, jsonify
|
||||||
|
|
||||||
from api.db import LLMType
|
from api.db import LLMType
|
||||||
|
from api.db.services.document_service import DocumentService
|
||||||
from api.db.services.knowledgebase_service import KnowledgebaseService
|
from api.db.services.knowledgebase_service import KnowledgebaseService
|
||||||
from api.db.services.llm_service import LLMBundle
|
from api.db.services.llm_service import LLMBundle
|
||||||
from api import settings
|
from api import settings
|
||||||
@ -70,12 +71,13 @@ def retrieval(tenant_id):
|
|||||||
|
|
||||||
records = []
|
records = []
|
||||||
for c in ranks["chunks"]:
|
for c in ranks["chunks"]:
|
||||||
|
e, doc = DocumentService.get_by_id( c["doc_id"])
|
||||||
c.pop("vector", None)
|
c.pop("vector", None)
|
||||||
records.append({
|
records.append({
|
||||||
"content": c["content_with_weight"],
|
"content": c["content_with_weight"],
|
||||||
"score": c["similarity"],
|
"score": c["similarity"],
|
||||||
"title": c["docnm_kwd"],
|
"title": c["docnm_kwd"],
|
||||||
"metadata": {}
|
"metadata": doc.meta_fields
|
||||||
})
|
})
|
||||||
|
|
||||||
return jsonify({"records": records})
|
return jsonify({"records": records})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user