feat: OCR v2 batch + RIIN waybill + 双系统 label-ocr flow(hourly)

This commit is contained in:
yeuimu
2026-07-23 23:44:24 +00:00
parent 51dbde4538
commit 70178e9295
7 changed files with 175 additions and 114 deletions
+10
View File
@@ -25,6 +25,16 @@ class OcrClient:
resp.raise_for_status()
return OcrResult.model_validate(resp.json())
def recognize_batch(self, urls: list[dict[str, str]], country: str = "US") -> list[OcrResult]:
"""v2 批量识别:urls=[{"url":"...", "filename":"orderNo"}], 最多 200 项/批。
返回 OcrResult 列表,file 字段 = filename(用于回匹配 orderNo)。
"""
resp = self._http.post("/api/v2/batch", json={"urls": urls, "country": country}, timeout=300.0)
resp.raise_for_status()
data = resp.json()
return [OcrResult.model_validate(r) for r in data.get("results", [])]
def health(self) -> bool:
"""健康检查。"""
try: