refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名
This commit is contained in:
1 parent
dde25344ca
commit
46eb63f5bb
111 files changed
+3116
-1250
No files matched your search
@@ -116,10 +116,6 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
{
|
||||
"agent_runtime_context": runtime_context,
|
||||
"input_snapshot_hash": _str_prop("get_order_extraction_context 返回的不可变输入快照 SHA-256"),
|
||||
"schema_version": _str_prop(
|
||||
"固定为 shipping-order-extraction-v1",
|
||||
enum=["shipping-order-extraction-v1"],
|
||||
),
|
||||
"orders": {
|
||||
"type": "array",
|
||||
"description": "LLM 从一封或多封邮件中识别出的订单数组;一个附件可产生多个订单,非发货邮件可为空数组",
|
||||
@@ -143,9 +139,9 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"classification_confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"field_confidence": {
|
||||
"type": "object",
|
||||
"required": ["sku", "qty"],
|
||||
"required": ["part_number", "qty"],
|
||||
"properties": {
|
||||
"sku": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"part_number": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"qty": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
},
|
||||
},
|
||||
@@ -154,30 +150,29 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["sku", "qty"],
|
||||
"required": ["part_number", "qty"],
|
||||
"properties": {
|
||||
"sku": _str_prop("SKU/料号"),
|
||||
"part_number": _str_prop("内部料号/主匹配料号"),
|
||||
"qty": {"type": "number", "exclusiveMinimum": 0},
|
||||
"reservation_id": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
|
||||
"source_type": _str_prop(
|
||||
"可选订单路由线索(库存来源提示);仅在原文有可靠证据时填写,"
|
||||
"inventory_source_hint": _str_prop(
|
||||
"可选库存来源提示;仅在原文有可靠证据时填写,"
|
||||
"不代表任务通知来源或已确认的库存连接器类型"
|
||||
),
|
||||
"hub_code": _str_prop(
|
||||
"可选 Hub/站点线索;与 source_type 独立落库,禁止折叠进 source_type"
|
||||
),
|
||||
"customer_part_number": _str_prop("可选客户料号"),
|
||||
"aws_part_number": _str_prop("可选 AWS 料号"),
|
||||
},
|
||||
"additionalProperties": True,
|
||||
"additionalProperties": False,
|
||||
},
|
||||
},
|
||||
"evidence": {
|
||||
"type": "array",
|
||||
"description": "至少分别提供 SKU 与 Qty 原文证据,元素含 field 与非空 quote",
|
||||
"description": "至少分别提供内部料号与 Qty 原文证据,元素含 field 与非空 quote",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["field", "quote"],
|
||||
"properties": {
|
||||
"field": _str_prop("证据字段,如 lines[0].sku 或 lines[0].qty"),
|
||||
"field": _str_prop("证据字段,如 lines[0].part_number 或 lines[0].qty"),
|
||||
"quote": _str_prop("原文片段,禁止改写"),
|
||||
"document_id": _int_prop("证据来源 Document ID"),
|
||||
},
|
||||
@@ -192,11 +187,11 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
},
|
||||
},
|
||||
},
|
||||
required=["agent_runtime_context", "input_snapshot_hash", "schema_version", "orders"],
|
||||
required=["agent_runtime_context", "input_snapshot_hash", "orders"],
|
||||
description=(
|
||||
"只接受 get_order_extraction_context 的同一快照。HXOPS 仅在分类、SKU/Qty 置信度及原文证据均达标,"
|
||||
"只接受 get_order_extraction_context 的同一快照。HXOPS 仅在分类、内部料号/Qty 置信度及原文证据均达标,"
|
||||
"且无阻断冲突/修订决策时自动建单;Reservation ID 允许缺失,"
|
||||
"订单行 Source Type / Hub Code 是可选路由线索并独立持久化。"
|
||||
"订单行 inventory_source_hint 是可选路由线索并独立持久化。"
|
||||
"响应以持久化结果分别返回 created_count、opened_existing_count、pending_count、"
|
||||
"non_shipping_count;auto_created_count 仅为兼容字段且等于 created_count。"
|
||||
),
|
||||
@@ -232,15 +227,15 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
),
|
||||
"/tools/update_notice_line": _post_op(
|
||||
"update_notice_line",
|
||||
"更新解析结果中的某一行,如 SKU、Reservation ID、数量、交期",
|
||||
"更新解析结果中的某一行,如内部料号、Reservation ID、数量、交期",
|
||||
{
|
||||
"task_id": task_id,
|
||||
"line_index": _int_prop("行下标,从 0 开始"),
|
||||
"patch": {
|
||||
"type": "object",
|
||||
"description": (
|
||||
"可更新字段:sku/reservation_id/quantity/qty/required_date/uom/source_type/hub_code;"
|
||||
"source_type 与 hub_code 均为可选订单路由线索并独立落库"
|
||||
"可更新字段:part_number/reservation_id/quantity/qty/required_date/uom/"
|
||||
"inventory_source_hint;inventory_source_hint 为可选订单路由线索"
|
||||
),
|
||||
"additionalProperties": True,
|
||||
},
|
||||
@@ -255,7 +250,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"task_id": task_id,
|
||||
"line": {
|
||||
"type": "object",
|
||||
"description": "新增行,至少包含 sku 和 qty/quantity",
|
||||
"description": "新增行,至少包含 part_number 和 qty/quantity",
|
||||
"additionalProperties": True,
|
||||
},
|
||||
"comment": _str_prop("修改备注(可选)"),
|
||||
@@ -284,7 +279,8 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
{
|
||||
"task_id": task_id,
|
||||
MAP_JSON: _str_prop(
|
||||
"Dify Tool 参数使用 JSON 字符串,内容含 sku/reservation_id/available_qty;"
|
||||
"Dify Tool 参数使用 JSON 字符串,内容含 part_number/reservation_id/available_qty,"
|
||||
"可选 aws_part_number;"
|
||||
"可选 match_rule(LLM 自然语言匹配说明)与 match_key(匹配键列表)。"
|
||||
),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user