From 2259bce7c4d5dc6c72b46786966183d30880a022 Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Thu, 24 Sep 2026 03:49:46 +0000 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20OCR=20=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=A5=BF=E7=8F=AD=E7=89=99/=E6=84=8F=E5=A4=A7?= =?UTF-8?q?=E5=88=A9/=E5=8A=A0=E6=8B=BF=E5=A4=A7(ES/IT/CA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - api/ocr/models.py: SUPPORTED_COUNTRIES/_COUNTRY_MAP 补 CA/ES/IT 的 ISO 码与中文国名 - flows/label_ocr.py: label-ocr 默认国家列表扩为 8 国,docstring 同步 --- api/ocr/models.py | 4 +++- flows/label_ocr.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/ocr/models.py b/api/ocr/models.py index 02ae53d..0d287be 100644 --- a/api/ocr/models.py +++ b/api/ocr/models.py @@ -37,14 +37,16 @@ class OcrResult(BaseModel): # OCR 服务已有分类器模型的国家(版面见 api.md §4) -SUPPORTED_COUNTRIES = {"US", "UK", "DE", "MX", "SA"} +SUPPORTED_COUNTRIES = {"US", "UK", "DE", "MX", "SA", "CA", "ES", "IT"} # ISO 国家代码 / 中文国名 → OCR 国家代码 _COUNTRY_MAP: dict[str, str] = { # 代码 "GB": "UK", "UK": "UK", "US": "US", "DE": "DE", "MX": "MX", "SA": "SA", + "CA": "CA", "ES": "ES", "IT": "IT", # 中文名 "英国": "UK", "美国": "US", "德国": "DE", "墨西哥": "MX", "沙特": "SA", + "加拿大": "CA", "西班牙": "ES", "意大利": "IT", } diff --git a/flows/label_ocr.py b/flows/label_ocr.py index 9362d77..dc05a98 100644 --- a/flows/label_ocr.py +++ b/flows/label_ocr.py @@ -137,12 +137,12 @@ def label_ocr( courier_source: str | None = None, days: int = 7, ) -> dict: - """面单 OCR enrichment。默认处理英国+美国,近 7 天下单的订单。 + """面单 OCR enrichment。默认处理全部已支持国家(见 api.ocr.models.SUPPORTED_COUNTRIES),近 7 天下单的订单。 - 手动跑其他国家: label_ocr(country_regions=['德国']) + 手动跑指定国家: label_ocr(country_regions=['德国']) """ if country_regions is None: - country_regions = ['英国', '美国', '墨西哥', '德国', '沙特'] + country_regions = ['英国', '美国', '墨西哥', '德国', '沙特', '加拿大', '西班牙', '意大利'] if _has_running_peer(): print("已有 label-ocr 在运行,跳过本次") return {"skipped": True} From c6be5bacf6b8ee415b5273c449a18f7b53c33ae7 Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Thu, 24 Sep 2026 03:53:34 +0000 Subject: [PATCH 2/2] =?UTF-8?q?ci:=20=E6=A3=80=E5=87=BA=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=20AGit=20PR=20=E7=9A=84=20refs/pull/N/head(clone=20--branch=20?= =?UTF-8?q?=E5=8F=AA=E8=AE=A4=E5=88=86=E6=94=AF=E5=90=8D,=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20fetch=20=E5=90=8E=20checkout)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 192c596..3f79aa4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -12,7 +12,10 @@ jobs: - name: 检出代码 run: | REF="${{ github.event.pull_request.head.ref || github.ref_name }}" - git clone --depth 1 --branch "$REF" "${{ github.server_url }}/${{ github.repository }}.git" . + git clone --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" . + # PR head 可能是完整 ref(AGit 建的 PR 为 refs/pull/N/head),clone --branch 只认分支名,改 fetch 后 checkout + git fetch --depth 1 origin "$REF" + git checkout --detach FETCH_HEAD - name: 安装 uv run: curl -LsSf https://astral.sh/uv/install.sh | sh - name: 安装依赖