feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议
This commit is contained in:
1 parent
46eb63f5bb
commit
e9bdd81f1a
320 files changed
+28361
-10487
No files matched your search
@@ -77,6 +77,8 @@
|
||||
"refs.run_purpose",
|
||||
"refs.schedule_task_id",
|
||||
"refs.task_no",
|
||||
"refs.temporary_inventory_asset_no",
|
||||
"refs.temporary_inventory_session_no",
|
||||
"schema_version",
|
||||
"scope"
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"post": {
|
||||
"operationId": "get_order_extraction_context",
|
||||
"summary": "读取点击发送后完整订单抽取所需的邮件正文与附件文本",
|
||||
"description": "仅在 refs.capability=order_extraction 分支调用。Tool 从 platform.session_id 反查当前用户,并返回 input_snapshot_hash、documents 与固定输出契约;禁止让 LLM 传 user_id。",
|
||||
"description": "仅在 refs.capability=order_extraction 分支调用。Tool 从 platform.session_id 反查当前用户,并返回 input_snapshot_hash、documents 与当前 published 动态 Schema 契约;禁止让 LLM 传 user_id。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
@@ -54,7 +54,7 @@
|
||||
"post": {
|
||||
"operationId": "submit_order_extraction",
|
||||
"summary": "提交完整订单抽取结果,由 HXOPS 执行证据校验、订单级判重与自动建单",
|
||||
"description": "只接受 get_order_extraction_context 的同一快照。HXOPS 仅在分类、内部料号/Qty 置信度及原文证据均达标,且无阻断冲突/修订决策时自动建单;Reservation ID 允许缺失,订单行 inventory_source_hint 是可选路由线索并独立持久化。响应以持久化结果分别返回 created_count、opened_existing_count、pending_count、non_shipping_count;auto_created_count 仅为兼容字段且等于 created_count。",
|
||||
"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,
|
||||
@@ -78,19 +78,28 @@
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schema_version_id",
|
||||
"schema_checksum",
|
||||
"source_intake_no",
|
||||
"primary_document_id",
|
||||
"classification",
|
||||
"classification_confidence",
|
||||
"field_confidence",
|
||||
"lines",
|
||||
"evidence"
|
||||
"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,必须来自上下文"
|
||||
@@ -113,91 +122,116 @@
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"field_confidence": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"part_number",
|
||||
"qty"
|
||||
],
|
||||
"properties": {
|
||||
"part_number": {
|
||||
"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
|
||||
}
|
||||
}
|
||||
},
|
||||
"qty": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
}
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"po_number": {
|
||||
"type": "string",
|
||||
"description": "可为空的 PO/订单号"
|
||||
},
|
||||
"lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"part_number",
|
||||
"qty"
|
||||
"fields"
|
||||
],
|
||||
"properties": {
|
||||
"part_number": {
|
||||
"type": "string",
|
||||
"description": "内部料号/主匹配料号"
|
||||
},
|
||||
"qty": {
|
||||
"type": "number",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
"reservation_id": {
|
||||
"type": "string",
|
||||
"description": "可为空,缺失时 Task 停在补字段门禁"
|
||||
},
|
||||
"inventory_source_hint": {
|
||||
"type": "string",
|
||||
"description": "可选库存来源提示;仅在原文有可靠证据时填写,不代表任务通知来源或已确认的库存连接器类型"
|
||||
},
|
||||
"customer_part_number": {
|
||||
"type": "string",
|
||||
"description": "可选客户料号"
|
||||
},
|
||||
"aws_part_number": {
|
||||
"type": "string",
|
||||
"description": "可选 AWS 料号"
|
||||
"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
|
||||
}
|
||||
},
|
||||
"evidence": {
|
||||
"type": "array",
|
||||
"description": "至少分别提供内部料号与 Qty 原文证据,元素含 field 与非空 quote",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"field",
|
||||
"quote"
|
||||
],
|
||||
"properties": {
|
||||
"field": {
|
||||
"type": "string",
|
||||
"description": "证据字段,如 lines[0].part_number 或 lines[0].qty"
|
||||
},
|
||||
"quote": {
|
||||
"type": "string",
|
||||
"description": "原文片段,禁止改写"
|
||||
},
|
||||
"document_id": {
|
||||
"type": "integer",
|
||||
"description": "证据来源 Document ID"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conflicts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -233,6 +267,194 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/create_temporary_inventory_session": {
|
||||
"post": {
|
||||
"operationId": "create_temporary_inventory_session",
|
||||
"summary": "创建对话上传库存文件的临时分析会话",
|
||||
"description": "仅在用户明确说明附件为库存文件的 temporary_inventory 分支调用。后端按会话用户校验资产归属并执行结构初检;不会创建生产库存快照、不会绑定库存站点、不会执行库存匹配。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_runtime_context": {
|
||||
"type": "string",
|
||||
"description": "HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
},
|
||||
"asset_no": {
|
||||
"type": "string",
|
||||
"description": "当前用户上传的 FileAsset 编号;必须是 xls、xlsx 或 csv"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"agent_runtime_context",
|
||||
"asset_no"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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/get_temporary_inventory_session": {
|
||||
"post": {
|
||||
"operationId": "get_temporary_inventory_session",
|
||||
"summary": "读取临时库存文件的脱敏结构分析和方案候选",
|
||||
"description": "返回后端已分析的工作表、表头、字段目录和已发布方案候选,不返回样例库存值。Dify 不得读取文件路径、全量库存行,也不得据此直接宣称库存已可用于订单匹配。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_runtime_context": {
|
||||
"type": "string",
|
||||
"description": "HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
},
|
||||
"temporary_session_no": {
|
||||
"type": "string",
|
||||
"description": "create_temporary_inventory_session 返回的临时会话编号"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"agent_runtime_context",
|
||||
"temporary_session_no"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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_temporary_inventory_mapping_suggestion": {
|
||||
"post": {
|
||||
"operationId": "submit_temporary_inventory_mapping_suggestion",
|
||||
"summary": "保存对话临时库存的候选字段映射",
|
||||
"description": "仅在没有 exact 已发布方案可复用时调用。HXOPS 校验字段目录、真实表头、重复列和核心字段完整性,只保存待用户确认的候选;不会发布方案、绑定库存站点、创建库存快照或执行订单匹配。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_runtime_context": {
|
||||
"type": "string",
|
||||
"description": "HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
},
|
||||
"temporary_session_no": {
|
||||
"type": "string",
|
||||
"description": "临时库存会话编号"
|
||||
},
|
||||
"field_mapping": {
|
||||
"type": "object",
|
||||
"description": "库存字段目录 ID 到真实来源表头的映射;只能使用 get_temporary_inventory_session 返回的字段 ID 和表头",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"agent_runtime_context",
|
||||
"temporary_session_no",
|
||||
"field_mapping"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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/confirm_temporary_inventory_use": {
|
||||
"post": {
|
||||
"operationId": "confirm_temporary_inventory_use",
|
||||
"summary": "确认当前对话临时库存文件使用",
|
||||
"description": "仅在用户明确确认本次使用后调用。HXOPS 重新确定性解析文件并校验料号、预约号、库存数量;只锁定当前对话的临时会话审计,不接受任务编号,绝不创建生产库存快照、绑定库存站点、写入任务库存行或执行库存匹配。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_runtime_context": {
|
||||
"type": "string",
|
||||
"description": "HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
|
||||
},
|
||||
"temporary_session_no": {
|
||||
"type": "string",
|
||||
"description": "临时库存会话编号"
|
||||
},
|
||||
"selected_profile_id": {
|
||||
"type": "integer",
|
||||
"description": "仅 exact 已发布方案候选时由用户选择的方案 ID"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"agent_runtime_context",
|
||||
"temporary_session_no"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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/parse_notice": {
|
||||
"post": {
|
||||
"operationId": "parse_notice",
|
||||
@@ -485,94 +707,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/get_inventory_schema_preview": {
|
||||
"post": {
|
||||
"operationId": "get_inventory_schema_preview",
|
||||
"summary": "读取已上传库存 Excel 的表头与样例行(小 payload,供 LLM 推断列映射)",
|
||||
"description": "读取已上传库存 Excel 的表头与样例行(小 payload,供 LLM 推断列映射)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务引用:技术任务号 SN-20260529-ABCD1234 或业务号 WYC26071501"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"task_id"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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/apply_inventory_mapping": {
|
||||
"post": {
|
||||
"operationId": "apply_inventory_mapping",
|
||||
"summary": "应用 LLM/人工列映射并解析完整库存文件;返回 field_alignment 等待用户确认,后续主流程由后台任务续跑",
|
||||
"description": "应用 LLM/人工列映射并解析完整库存文件;返回 field_alignment 等待用户确认,后续主流程由后台任务续跑",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务引用:技术任务号 SN-20260529-ABCD1234 或业务号 WYC26071501"
|
||||
},
|
||||
"map_json": {
|
||||
"type": "string",
|
||||
"description": "Dify Tool 参数使用 JSON 字符串,内容含 part_number/reservation_id/available_qty,可选 aws_part_number;可选 match_rule(LLM 自然语言匹配说明)与 match_key(匹配键列表)。"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"task_id",
|
||||
"map_json"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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/confirm_inventory_source": {
|
||||
"post": {
|
||||
"operationId": "confirm_inventory_source",
|
||||
"summary": "在库存源人工检查点确认正式库存查询来源(仅提交 source_code)",
|
||||
"description": "库存连接器门禁:稳定身份须同时具备 source_code、connector_type、site_id、warehouse_id,且 routing_fingerprint 与当前配置版本一致。Tool API 使用集成密钥鉴权,确认人审计由宿主会话内部链路写入,不接受外部 user_id。若返回 needs_human,说明身份未完整解析或需先完成解析确认。",
|
||||
"description": "库存连接器门禁:稳定身份须具备 source_code、connector_type;fixed Source 同时具备 warehouse_id,且 routing_fingerprint 与当前配置版本一致。Tool API 使用集成密钥鉴权,确认人审计由宿主会话内部链路写入,不接受外部 user_id。若返回 needs_human,说明身份未完整解析或需先完成解析确认。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
@@ -587,7 +726,7 @@
|
||||
},
|
||||
"source_code": {
|
||||
"type": "string",
|
||||
"description": "启用配置中的库存源编码,如 DSV360_AWSDU、CRANE;站点 site_id 与库位 warehouse_id 由后端根据配置与订单路由解析,禁止前端直传"
|
||||
"description": "启用配置中的库存源编码;Warehouse 由 fixed Source 配置或库存行匹配解析,禁止前端直传"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -679,17 +818,14 @@
|
||||
},
|
||||
"decision": {
|
||||
"type": "string",
|
||||
"description": "confirm=确认继续;reject=驳回;retry_rpa=重新获取库存(清理旧库存解析状态并重新触发 RPA);rematch=重新匹配;reparse=重新解析;confirm_inventory_mapping=确认库存字段对齐;correct_inventory_mapping=更正列映射;reparse_inventory=重新上传库存",
|
||||
"description": "confirm=确认继续;reject=驳回;retry_rpa=按已发布解析方案重新获取库存;rematch=重新匹配;reparse=重新解析",
|
||||
"enum": [
|
||||
"confirm",
|
||||
"confirm_parse",
|
||||
"reject",
|
||||
"retry_rpa",
|
||||
"rematch",
|
||||
"reparse",
|
||||
"confirm_inventory_mapping",
|
||||
"correct_inventory_mapping",
|
||||
"reparse_inventory"
|
||||
"reparse"
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
@@ -722,7 +858,7 @@
|
||||
"post": {
|
||||
"operationId": "get_task_status",
|
||||
"summary": "查询任务当前状态与 human_options;响应含库存连接器独立字段与候选结构",
|
||||
"description": "返回 inventory_source_code、inventory_connector_type、inventory_site_id、inventory_warehouse_id、inventory_source_status(unresolved|ambiguous|resolved|user_confirmed|invalid|conflicted)、inventory_source_method、inventory_source_config_version、inventory_routing_fingerprint、inventory_source_confirmed_by、inventory_source_confirmed_at,以及 step_payload.inventory_source_resolution.candidates。",
|
||||
"description": "返回 inventory_source_code、inventory_connector_type、inventory_warehouse_id、inventory_source_status(unresolved|ambiguous|resolved|user_confirmed|invalid|conflicted)、inventory_source_method、inventory_source_config_version、inventory_routing_fingerprint、inventory_source_confirmed_by、inventory_source_confirmed_at,以及 step_payload.inventory_source_resolution.candidates。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
|
||||
Reference in new issue
Block a user