feat(shipping-notice): 增强发货通知候选管理功能,支持候选选择、重复检测与业务摘要修订
This commit is contained in:
1 parent
70f684b94a
commit
b595e157e9
83 files changed
+5857
-200
No files matched your search
@@ -74,6 +74,9 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
|
||||
task_id = _str_prop("发货任务编号(task id),如 SN-20260529-ABCD1234")
|
||||
batch_id = _str_prop("发货批次编号(batch id),如 SB-20260617-ABCD1234")
|
||||
runtime_context = _str_prop(
|
||||
"HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
)
|
||||
|
||||
return {
|
||||
"openapi": "3.0.0",
|
||||
@@ -97,6 +100,99 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
},
|
||||
"servers": [{"url": server}],
|
||||
"paths": {
|
||||
"/tools/get_order_extraction_context": _post_op(
|
||||
"get_order_extraction_context",
|
||||
"读取点击发送后完整订单抽取所需的邮件正文与附件文本",
|
||||
{"agent_runtime_context": runtime_context},
|
||||
required=["agent_runtime_context"],
|
||||
description=(
|
||||
"仅在 refs.capability=order_extraction 分支调用。Tool 从 platform.session_id 反查当前用户,"
|
||||
"并返回 input_snapshot_hash、documents 与固定输出契约;禁止让 LLM 传 user_id。"
|
||||
),
|
||||
),
|
||||
"/tools/submit_order_extraction": _post_op(
|
||||
"submit_order_extraction",
|
||||
"提交完整订单抽取结果,由 HXOPS 执行证据校验、订单级判重与自动建单",
|
||||
{
|
||||
"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 从一封或多封邮件中识别出的订单数组;一个附件可产生多个订单,非发货邮件可为空数组",
|
||||
"maxItems": 50,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"source_intake_no",
|
||||
"primary_document_id",
|
||||
"classification",
|
||||
"classification_confidence",
|
||||
"field_confidence",
|
||||
"lines",
|
||||
"evidence",
|
||||
],
|
||||
"properties": {
|
||||
"source_intake_no": _str_prop("来源 Intake 编号,必须来自上下文"),
|
||||
"primary_document_id": _int_prop("主来源 Document ID,必须来自上下文"),
|
||||
"candidate_key_hint": _str_prop("可选稳定订单标识,如 PO/订单号;不得使用随机值"),
|
||||
"classification": _str_prop("仅 shipping_request 可自动建单", enum=["shipping_request", "non_shipping_request", "uncertain"]),
|
||||
"classification_confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"field_confidence": {
|
||||
"type": "object",
|
||||
"required": ["sku", "qty"],
|
||||
"properties": {
|
||||
"sku": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"qty": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
},
|
||||
},
|
||||
"po_number": _str_prop("可为空的 PO/订单号"),
|
||||
"lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["sku", "qty"],
|
||||
"properties": {
|
||||
"sku": _str_prop("SKU/料号"),
|
||||
"qty": {"type": "number", "exclusiveMinimum": 0},
|
||||
"reservation_id": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
|
||||
"hub_code": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
|
||||
"source_type": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
|
||||
},
|
||||
"additionalProperties": True,
|
||||
},
|
||||
},
|
||||
"evidence": {
|
||||
"type": "array",
|
||||
"description": "至少分别提供 SKU 与 Qty 原文证据,元素含 field 与非空 quote",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["field", "quote"],
|
||||
"properties": {
|
||||
"field": _str_prop("证据字段,如 lines[0].sku 或 lines[0].qty"),
|
||||
"quote": _str_prop("原文片段,禁止改写"),
|
||||
"document_id": _int_prop("证据来源 Document ID"),
|
||||
},
|
||||
},
|
||||
},
|
||||
"conflicts": {
|
||||
"type": "array",
|
||||
"items": {"type": "object", "additionalProperties": True},
|
||||
},
|
||||
},
|
||||
"additionalProperties": True,
|
||||
},
|
||||
},
|
||||
},
|
||||
required=["agent_runtime_context", "input_snapshot_hash", "schema_version", "orders"],
|
||||
description=(
|
||||
"只接受 get_order_extraction_context 的同一快照。HXOPS 仅在分类、SKU/Qty 置信度及原文证据均达标,"
|
||||
"且无阻断冲突/修订决策时自动建单;Reservation ID、Hub Code、Source Type 允许缺失。"
|
||||
),
|
||||
),
|
||||
"/tools/parse_notice": _post_op(
|
||||
"parse_notice",
|
||||
"解析发货通知文本",
|
||||
@@ -134,7 +230,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"line_index": _int_prop("行下标,从 0 开始"),
|
||||
"patch": {
|
||||
"type": "object",
|
||||
"description": "可更新字段:sku/reservation_id/quantity/qty/required_date/uom",
|
||||
"description": "可更新字段:sku/reservation_id/quantity/qty/required_date/uom/hub_code/source_type",
|
||||
"additionalProperties": True,
|
||||
},
|
||||
"comment": _str_prop("修改备注(可选)"),
|
||||
|
||||
Reference in new issue
Block a user