feat(shipping-notice): 添加订单抽取功能,支持异步运行和管理,优化相关数据模型和处理逻辑
This commit is contained in:
1 parent
34d489a2d1
commit
ce26d6d0c4
144 files changed
+12241
-4233
No files matched your search
@@ -11,262 +11,6 @@
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/tools/get_order_extraction_context": {
|
||||
"post": {
|
||||
"operationId": "get_order_extraction_context",
|
||||
"summary": "读取点击发送后完整订单抽取所需的邮件正文与附件文本",
|
||||
"description": "仅在 refs.capability=order_extraction 分支调用。Tool 从 platform.session_id 反查当前用户,并返回 input_snapshot_hash、documents 与当前 published 动态 Schema 契约;禁止让 LLM 传 user_id。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_runtime_context": {
|
||||
"type": "string",
|
||||
"description": "HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"agent_runtime_context"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/submit_order_extraction": {
|
||||
"post": {
|
||||
"operationId": "submit_order_extraction",
|
||||
"summary": "提交完整订单抽取结果,由 HXOPS 执行证据校验、订单级判重与自动建单",
|
||||
"description": "只接受同一快照和同一 Schema checksum。Dify 必须逐字段返回稳定 field_id 与 observations[];每个 Observation 包含 value、document_id、逐字 quote 和可选 confidence。HXOPS 验证原文、执行类型/validator/证据策略与跨 Document 裁决后,才按 field_code 投影给下游。响应以持久化结果分别返回 created_count、opened_existing_count、pending_count、non_shipping_count;auto_created_count 仅为兼容字段且等于 created_count。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_runtime_context": {
|
||||
"type": "string",
|
||||
"description": "HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
},
|
||||
"input_snapshot_hash": {
|
||||
"type": "string",
|
||||
"description": "get_order_extraction_context 返回的不可变输入快照 SHA-256"
|
||||
},
|
||||
"orders": {
|
||||
"type": "array",
|
||||
"description": "LLM 从一封或多封邮件中识别出的订单数组;一个附件可产生多个订单,非发货邮件可为空数组",
|
||||
"maxItems": 50,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schema_version_id",
|
||||
"schema_checksum",
|
||||
"source_intake_no",
|
||||
"primary_document_id",
|
||||
"classification",
|
||||
"classification_confidence",
|
||||
"header_fields",
|
||||
"lines"
|
||||
],
|
||||
"properties": {
|
||||
"source_intake_no": {
|
||||
"type": "string",
|
||||
"description": "来源 Intake 编号,必须来自上下文"
|
||||
},
|
||||
"schema_version_id": {
|
||||
"type": "integer",
|
||||
"description": "context.contract.schema_version_id,必须原样回传"
|
||||
},
|
||||
"schema_checksum": {
|
||||
"type": "string",
|
||||
"description": "context.contract.checksum,必须原样回传"
|
||||
},
|
||||
"primary_document_id": {
|
||||
"type": "integer",
|
||||
"description": "主来源 Document ID,必须来自上下文"
|
||||
},
|
||||
"candidate_key_hint": {
|
||||
"type": "string",
|
||||
"description": "可选稳定订单标识,如 PO/订单号;不得使用随机值"
|
||||
},
|
||||
"classification": {
|
||||
"type": "string",
|
||||
"description": "仅 shipping_request 可自动建单",
|
||||
"enum": [
|
||||
"shipping_request",
|
||||
"non_shipping_request",
|
||||
"uncertain"
|
||||
]
|
||||
},
|
||||
"classification_confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"header_fields": {
|
||||
"type": "array",
|
||||
"description": "Header scope 动态字段;仅可使用 context.contract.fields 中的稳定 field_id",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"field_id",
|
||||
"observations"
|
||||
],
|
||||
"properties": {
|
||||
"field_id": {
|
||||
"type": "string",
|
||||
"description": "动态字段契约中的稳定 field_id,禁止传 field_code 或显示名称"
|
||||
},
|
||||
"observations": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"value",
|
||||
"document_id",
|
||||
"quote"
|
||||
],
|
||||
"properties": {
|
||||
"value": {
|
||||
"description": "从证据原文提取的字段值,类型必须符合动态字段契约"
|
||||
},
|
||||
"document_id": {
|
||||
"type": "integer",
|
||||
"description": "证据来源 Document ID,必须来自抽取上下文"
|
||||
},
|
||||
"quote": {
|
||||
"type": "string",
|
||||
"description": "证据原文中的逐字引用,HXOPS 将验证其确实存在"
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"fields"
|
||||
],
|
||||
"properties": {
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"description": "Line scope 动态字段;每项含 field_id 与 observations[]",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"field_id",
|
||||
"observations"
|
||||
],
|
||||
"properties": {
|
||||
"field_id": {
|
||||
"type": "string",
|
||||
"description": "动态字段契约中的稳定 field_id,禁止传 field_code 或显示名称"
|
||||
},
|
||||
"observations": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"value",
|
||||
"document_id",
|
||||
"quote"
|
||||
],
|
||||
"properties": {
|
||||
"value": {
|
||||
"description": "从证据原文提取的字段值,类型必须符合动态字段契约"
|
||||
},
|
||||
"document_id": {
|
||||
"type": "integer",
|
||||
"description": "证据来源 Document ID,必须来自抽取上下文"
|
||||
},
|
||||
"quote": {
|
||||
"type": "string",
|
||||
"description": "证据原文中的逐字引用,HXOPS 将验证其确实存在"
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"conflicts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"agent_runtime_context",
|
||||
"input_snapshot_hash",
|
||||
"orders"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/create_temporary_inventory_session": {
|
||||
"post": {
|
||||
"operationId": "create_temporary_inventory_session",
|
||||
|
||||
Reference in new issue
Block a user