Fix metadata in get_list() (#12906)

### What problem does this PR solve?

test_update_document.py failed as metadata is not included in the
response of get_list(), fix the issue.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
qinling0210
2026-01-30 14:06:49 +08:00
committed by GitHub
parent f262d416fe
commit 212d6f3660
2 changed files with 17 additions and 23 deletions

View File

@ -109,7 +109,12 @@ class DocumentService(CommonService):
count = docs.count()
docs = docs.paginate(page_number, items_per_page)
return list(docs.dicts()), count
docs_list = list(docs.dicts())
metadata_map = DocMetadataService.get_metadata_for_documents(None, kb_id)
for doc in docs_list:
doc["meta_fields"] = metadata_map.get(doc["id"], {})
return docs_list, count
@classmethod
@DB.connection_context()