mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-07-31 00:43:37 +08:00
Fix(api): correct document parsing progress check logic (#6318)
- Fix incorrect progress check condition that prevented re-parsing of completed documents - Allow parsing for documents with progress 0.0 (not started) or 1.0 (completed) - Only block parsing for documents currently in progress (0.0 < progress < 1.0) Close #6312 --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
parent
f0c4b28c6b
commit
1d9ca172e3
@ -688,9 +688,9 @@ def parse(tenant_id, dataset_id):
|
|||||||
continue
|
continue
|
||||||
if not doc:
|
if not doc:
|
||||||
return get_error_data_result(message=f"You don't own the document {id}.")
|
return get_error_data_result(message=f"You don't own the document {id}.")
|
||||||
if doc[0].progress != 0.0:
|
if 0.0 < doc[0].progress < 1.0:
|
||||||
return get_error_data_result(
|
return get_error_data_result(
|
||||||
"Can't stop parsing document with progress at 0 or 100"
|
"Can't parse document that is currently being processed"
|
||||||
)
|
)
|
||||||
info = {"run": "1", "progress": 0, "progress_msg": "", "chunk_num": 0, "token_num": 0}
|
info = {"run": "1", "progress": 0, "progress_msg": "", "chunk_num": 0, "token_num": 0}
|
||||||
DocumentService.update_by_id(id, info)
|
DocumentService.update_by_id(id, info)
|
||||||
|
@ -205,8 +205,7 @@ class TestDocumentsParse:
|
|||||||
res = parse_documnet(
|
res = parse_documnet(
|
||||||
get_http_api_auth, dataset_id, {"document_ids": document_ids}
|
get_http_api_auth, dataset_id, {"document_ids": document_ids}
|
||||||
)
|
)
|
||||||
assert res["code"] == 102
|
assert res["code"] == 0
|
||||||
assert res["message"] == "Can't stop parsing document with progress at 0 or 100"
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="issues/6234")
|
@pytest.mark.skip(reason="issues/6234")
|
||||||
def test_duplicate_parse(self, get_http_api_auth, tmp_path):
|
def test_duplicate_parse(self, get_http_api_auth, tmp_path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user