fix: OCR 区分 UNSUPPORTED(rejected) 和 ERROR(临时失败)
This commit is contained in:
@@ -28,6 +28,9 @@ _OCR_FIELD_MAP = [
|
|||||||
|
|
||||||
def _result_to_fields(r) -> dict[str, str | None]:
|
def _result_to_fields(r) -> dict[str, str | None]:
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
|
err = (r.error or "").lower()
|
||||||
|
if "reject" in err or "not a recognized layout" in err:
|
||||||
|
return {"ocrLayout": "UNSUPPORTED"}
|
||||||
return {"ocrLayout": "ERROR"}
|
return {"ocrLayout": "ERROR"}
|
||||||
return {col: (getattr(r, attr) or "") for attr, col in _OCR_FIELD_MAP}
|
return {col: (getattr(r, attr) or "") for attr, col in _OCR_FIELD_MAP}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user