Feat: Add support for document meta fields update through api (#5120)

### What problem does this PR solve?

add support for update document meta data through  api
### Type of change

- [x] New Feature (non-breaking change which adds functionality)

Co-authored-by: wenju.li <wenju.li@deepctr.cn>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
liwenju0
2025-02-19 13:39:31 +08:00
committed by GitHub
parent fab0f07379
commit 3ced290eb5
4 changed files with 12 additions and 0 deletions

View File

@ -255,6 +255,10 @@ def update_doc(tenant_id, dataset_id, document_id):
)
if not DocumentService.update_by_id(document_id, {"name": req["name"]}):
return get_error_data_result(message="Database error (Document rename)!")
if "meta_fields" in req:
if not isinstance(req["meta_fields"], dict):
return get_error_data_result(message="meta_fields must be a dictionary")
DocumentService.update_meta_fields(document_id, req["meta_fields"])
informs = File2DocumentService.get_by_document_id(document_id)
if informs: