From abd19b0f48864ba5200028d897a640d64df5731a Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Thu, 4 Sep 2025 17:48:00 +0800 Subject: [PATCH] Fix: wrong chunk number while re-parsing document and keeping original chunks (#9912) ### What problem does this PR solve? Fix wrong chunk number while re-parsing document and keeping original chunks ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu --- api/apps/document_app.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 5d1531f9e..c6280c6fb 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -456,8 +456,7 @@ def run(): cancel_all_task_of(id) else: return get_data_error_result(message="Cannot cancel a task that is not in RUNNING status") - - if str(req["run"]) == TaskStatus.RUNNING.value and str(doc.run) == TaskStatus.DONE.value: + if all([("delete" not in req or req["delete"]), str(req["run"]) == TaskStatus.RUNNING.value, str(doc.run) == TaskStatus.DONE.value]): DocumentService.clear_chunk_num_when_rerun(doc.id) DocumentService.update_by_id(id, info) @@ -683,7 +682,7 @@ def set_meta(): meta = json.loads(req["meta"]) if not isinstance(meta, dict): return get_json_result(data=False, message="Only dictionary type supported.", code=settings.RetCode.ARGUMENT_ERROR) - for k,v in meta.items(): + for k, v in meta.items(): if not isinstance(v, str) and not isinstance(v, int) and not isinstance(v, float): return get_json_result(data=False, message=f"The type is not supported: {v}", code=settings.RetCode.ARGUMENT_ERROR) except Exception as e: