feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
@@ -2,7 +2,7 @@
|
||||
backend/app/services/shipping_notice/field_adjudication.py
|
||||
|
||||
用途:把后端表格解析与 Dify LLM 输出转换为不可变字段 Observation,并生成规范订单行裁决结果。
|
||||
依赖:ShippingNoticeDocument、notice_lines、标准库 hashlib/json/re。
|
||||
依赖:ShippingOrderDocument、notice_lines、标准库 hashlib/json/re。
|
||||
逻辑:后台 Run 结果持久化在 Candidate 校验前调用;原始 Observation 只追加不互相覆盖,裁决结果另行投影。
|
||||
"""
|
||||
|
||||
@@ -14,7 +14,7 @@ import re
|
||||
from decimal import Decimal, InvalidOperation
|
||||
from typing import Any
|
||||
|
||||
from app.models import ShippingNoticeDocument
|
||||
from app.models import ShippingOrderDocument
|
||||
from app.services.shipping_notice.notice_lines import normalize_notice_line, parse_notice_table_text
|
||||
from app.services.shipping_notice.order_schema.table_contract import compile_table_header_contract
|
||||
|
||||
@@ -70,7 +70,7 @@ def _quote_supports_value(field: str, value: Any, quote: str) -> bool:
|
||||
def _evidence_for_field(
|
||||
*,
|
||||
evidence_items: list[dict[str, Any]],
|
||||
documents_by_id: dict[int, ShippingNoticeDocument],
|
||||
documents_by_id: dict[int, ShippingOrderDocument],
|
||||
line_index: int,
|
||||
field: str,
|
||||
value: Any,
|
||||
@@ -129,7 +129,7 @@ def _make_observation(
|
||||
|
||||
|
||||
def _backend_rows(
|
||||
documents: list[ShippingNoticeDocument], *, schema_definition: dict[str, Any],
|
||||
documents: list[ShippingOrderDocument], *, schema_definition: dict[str, Any],
|
||||
) -> list[dict[str, Any]]:
|
||||
"""从每个锁定 Document 的保留列边界文本生成后端表格 Observation 原料。"""
|
||||
contract = compile_table_header_contract(schema_definition)
|
||||
@@ -170,7 +170,7 @@ def _dify_observations(
|
||||
normalized_line: dict[str, Any],
|
||||
line_index: int,
|
||||
evidence_items: list[dict[str, Any]],
|
||||
documents_by_id: dict[int, ShippingNoticeDocument],
|
||||
documents_by_id: dict[int, ShippingOrderDocument],
|
||||
field_confidence: dict[str, Any],
|
||||
) -> list[dict[str, Any]]:
|
||||
"""将 Dify 行转换为 Observation;自报 confidence 只贡献最多 10 分。"""
|
||||
@@ -326,7 +326,7 @@ def adjudicate_order_fields(
|
||||
summary: dict[str, Any],
|
||||
*,
|
||||
raw_order: dict[str, Any],
|
||||
documents: list[ShippingNoticeDocument],
|
||||
documents: list[ShippingOrderDocument],
|
||||
schema_definition: dict[str, Any],
|
||||
field_confidence: dict[str, Any] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
|
||||
Reference in new issue
Block a user