瀏覽代碼

Fix: empty value updating. (#5949)

### What problem does this PR solve?

#5920

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.17.2
Kevin Hu 7 月之前
父節點
當前提交
80f87913bb
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      api/apps/sdk/dataset.py

+ 5
- 1
api/apps/sdk/dataset.py 查看文件

@@ -377,7 +377,7 @@ def update(tenant_id, dataset_id):
if req["document_count"] != kb.doc_num:
return get_error_data_result(message="Can't change `document_count`.")
req.pop("document_count")
if "chunk_method" in req:
if req.get("chunk_method"):
if kb.chunk_num != 0 and req["chunk_method"] != kb.parser_id:
return get_error_data_result(
message="If `chunk_count` is not 0, `chunk_method` is not changeable."
@@ -439,6 +439,10 @@ def update(tenant_id, dataset_id):
return get_error_data_result(
message="Duplicated dataset name in updating dataset."
)
flds = list(req.keys())
for f in flds:
if req[f] == "" and f in ["permission", "parser_id", "chunk_method"]:
del req[f]
if not KnowledgebaseService.update_by_id(kb.id, req):
return get_error_data_result(message="Update dataset error.(Database error)")
return get_result(code=settings.RetCode.SUCCESS)

Loading…
取消
儲存