docs(tec): 更新货代发货通知批次库存能力文档
- 添加单票与多票发货需求的处理方式 - 说明库存 Excel 上传后的保存与关联机制 - 解释库存匹配与 Excel 生成的独立执行方式 - 明确批次库存的真相来源 feat(chat): 优化发货库存上传提示语 - 根据上传结果生成更详细的提示信息 - 增加批次号的提示逻辑 - 使用国际化支持替换硬编码字符串 refactor(chat): 重构发货库存上传处理逻辑 - 移除多余的任务选择逻辑 - 简化上传处理流程 - 增强代码可读性与维护性 feat(locales): 更新多语言支持的提示信息 - 添加库存上传与任务处理的多语言提示 - 更新库存缺口与任务状态的描述
This commit is contained in:
1 parent
1bd9f278fe
commit
1cf8ff40bd
34 files changed
+4367
-3553
No files matched your search
@@ -3,7 +3,7 @@
|
||||
"info": {
|
||||
"title": "Hxops Shipping Notice Tools",
|
||||
"version": "1.0.0",
|
||||
"description": "货代发货通知 Agent Tool API。仅包含 Chatflow 编排工具,不含 RPA 回调。鉴权:Authorization Bearer 或 X-Integration-Key。"
|
||||
"description": "货代发货通知 Agent Tool API。仅导出适合 Dify AI 编排层使用的工具:通知理解、字段修订、库存映射建议、人工确认收口与状态查询;不包含由 hxops worker 统一续跑的主推进工具,也不包含 RPA 回调。鉴权:Authorization Bearer 或 X-Integration-Key。"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
@@ -11,132 +11,6 @@
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/tools/create_batch": {
|
||||
"post": {
|
||||
"operationId": "create_batch",
|
||||
"summary": "创建发货批次 batch(一次多文件上传的聚合容器)",
|
||||
"description": "创建发货批次 batch(一次多文件上传的聚合容器)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"batch_no": {
|
||||
"type": "string",
|
||||
"description": "已存在的批次编号(可选)。传入时将直接复用该批次。"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "integer",
|
||||
"description": "Hxops 用户 ID(可选)"
|
||||
},
|
||||
"conversation_id": {
|
||||
"type": "string",
|
||||
"description": "Dify 会话 ID,便于工作台关联"
|
||||
},
|
||||
"file_count": {
|
||||
"type": "integer",
|
||||
"description": "本批通知文件数量"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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_task": {
|
||||
"post": {
|
||||
"operationId": "create_task",
|
||||
"summary": "创建发货任务 task(可挂到某个 batch)",
|
||||
"description": "创建发货任务 task(可挂到某个 batch)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"batch_no": {
|
||||
"type": "string",
|
||||
"description": "发货批次编号(batch id),如 SB-20260617-ABCD1234"
|
||||
},
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "已存在的发货任务编号(可选)。传入时将直接复用该任务,禁止重复创建。"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "integer",
|
||||
"description": "Hxops 用户 ID(可选)"
|
||||
},
|
||||
"conversation_id": {
|
||||
"type": "string",
|
||||
"description": "Dify 会话 ID,便于工作台关联"
|
||||
},
|
||||
"source_type": {
|
||||
"type": "string",
|
||||
"description": "来源:manual|email|wecom|pdf",
|
||||
"enum": [
|
||||
"manual",
|
||||
"email",
|
||||
"wecom",
|
||||
"pdf"
|
||||
]
|
||||
},
|
||||
"source_file_name": {
|
||||
"type": "string",
|
||||
"description": "原始通知文件名(多文件场景建议传)"
|
||||
},
|
||||
"source_file_type": {
|
||||
"type": "string",
|
||||
"description": "原始通知文件类型(多文件场景建议传)"
|
||||
},
|
||||
"batch_index": {
|
||||
"type": "integer",
|
||||
"description": "当前任务在批次中的顺序,从 1 开始"
|
||||
},
|
||||
"batch_total": {
|
||||
"type": "integer",
|
||||
"description": "当前批次总任务数"
|
||||
},
|
||||
"raw_content": {
|
||||
"type": "string",
|
||||
"description": "原始发货通知文本(可选,后续 parse 也可传入)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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",
|
||||
@@ -389,70 +263,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/parse_inventory": {
|
||||
"post": {
|
||||
"operationId": "parse_inventory",
|
||||
"summary": "解析库存。大 Excel 禁止 raw_inventory_text(会超 LLM token);先 POST /tools/upload_inventory_file 上传,再 get_inventory_schema_preview → apply_inventory_mapping;或 use_uploaded_file=true(规则映射兜底)。小表可粘贴文本。成功后 stop_agent_turn,等 confirm_inventory_mapping 后再 match。",
|
||||
"description": "解析库存。大 Excel 禁止 raw_inventory_text(会超 LLM token);先 POST /tools/upload_inventory_file 上传,再 get_inventory_schema_preview → apply_inventory_mapping;或 use_uploaded_file=true(规则映射兜底)。小表可粘贴文本。成功后 stop_agent_turn,等 confirm_inventory_mapping 后再 match。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
},
|
||||
"use_uploaded_file": {
|
||||
"type": "string",
|
||||
"description": "true=解析该任务已上传的 Excel(服务端直传,不经过 LLM)",
|
||||
"enum": [
|
||||
"true",
|
||||
"false"
|
||||
]
|
||||
},
|
||||
"map_json": {
|
||||
"type": "string",
|
||||
"description": "可选,列映射 JSON 字符串,如 {\"sku\":\"AWS Sku\",\"available_qty\":\"Qty Available\"}"
|
||||
},
|
||||
"raw_inventory_text": {
|
||||
"type": "string",
|
||||
"description": "仅小表(约 <8 万字符)。大 Excel 勿传此字段,改用 upload_inventory_file"
|
||||
},
|
||||
"inventory_lines_json": {
|
||||
"type": "string",
|
||||
"description": "可选,已整理好的 JSON 数组字符串,如 [{\"sku\":\"A001\",\"available_qty\":10}]"
|
||||
}
|
||||
},
|
||||
"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/get_inventory_schema_preview": {
|
||||
"post": {
|
||||
"operationId": "get_inventory_schema_preview",
|
||||
"summary": "读取已上传库存 Excel 的表头与样例行(小 payload,供 LLM 推断列映射)",
|
||||
"description": "读取已上传库存 Excel 的表头与样例行(小 payload,供 LLM 推断列映射)",
|
||||
"summary": "读取已上传批次库存快照的表头与样例行(小 payload,供 LLM 推断列映射)",
|
||||
"description": "读取已上传批次库存快照的表头与样例行(小 payload,供 LLM 推断列映射)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
@@ -490,8 +305,8 @@
|
||||
"/tools/apply_inventory_mapping": {
|
||||
"post": {
|
||||
"operationId": "apply_inventory_mapping",
|
||||
"summary": "应用 LLM/人工列映射并解析完整库存文件;返回 field_alignment 等待用户确认",
|
||||
"description": "应用 LLM/人工列映射并解析完整库存文件;返回 field_alignment 等待用户确认",
|
||||
"summary": "应用 LLM/人工列映射并解析完整批次库存快照;返回 field_alignment 等待用户确认,后续本批各票由 hxops worker 独立续跑",
|
||||
"description": "应用 LLM/人工列映射并解析完整批次库存快照;返回 field_alignment 等待用户确认,后续本批各票由 hxops worker 独立续跑",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
@@ -531,145 +346,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/ensure_inventory": {
|
||||
"post": {
|
||||
"operationId": "ensure_inventory",
|
||||
"summary": "确保库存快照可用(RPA 自动导出;对话库存请优先用 parse_inventory)",
|
||||
"description": "确保库存快照可用(RPA 自动导出;对话库存请优先用 parse_inventory)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string",
|
||||
"description": "auto=自动/RPA;retry_rpa=重试 RPA",
|
||||
"enum": [
|
||||
"auto",
|
||||
"retry_rpa"
|
||||
]
|
||||
},
|
||||
"inventory_lines_json": {
|
||||
"type": "string",
|
||||
"description": "手工库存 JSON 数组字符串,如 [{\"sku\":\"A001\",\"available_qty\":10}]"
|
||||
}
|
||||
},
|
||||
"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/auto_progress": {
|
||||
"post": {
|
||||
"operationId": "auto_progress",
|
||||
"summary": "按后端全局配置自动推进:RPA 获取库存 → 字段对齐(满足条件可自动确认)→ 匹配 → 生成 Excel →(可选)上传。遇到人工节点会停住返回 action_buttons。",
|
||||
"description": "按后端全局配置自动推进:RPA 获取库存 → 字段对齐(满足条件可自动确认)→ 匹配 → 生成 Excel →(可选)上传。遇到人工节点会停住返回 action_buttons。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
},
|
||||
"conversation_id": {
|
||||
"type": "string",
|
||||
"description": "Dify 会话 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/match_inventory": {
|
||||
"post": {
|
||||
"operationId": "match_inventory",
|
||||
"summary": "匹配发货需求与库存。前置条件:submit_decision(confirm_inventory_mapping) 已成功;未确认时调用会被拒绝并返回 forbidden_next_tools",
|
||||
"description": "匹配发货需求与库存。前置条件:submit_decision(confirm_inventory_mapping) 已成功;未确认时调用会被拒绝并返回 forbidden_next_tools",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
},
|
||||
"inventory_lines_json": {
|
||||
"type": "string",
|
||||
"description": "可选,覆盖库存 JSON 数组后再匹配"
|
||||
}
|
||||
},
|
||||
"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/submit_decision": {
|
||||
"post": {
|
||||
"operationId": "submit_decision",
|
||||
"summary": "人工复核决策。task_id 与 conversation_id 至少传一个;用户确认时禁止 create_task",
|
||||
"description": "人工复核决策。task_id 与 conversation_id 至少传一个;用户确认时禁止 create_task",
|
||||
"summary": "人工复核决策。task_id 与 conversation_id 至少传一个;用户确认时禁止 create_task。决策提交后由 hxops worker 统一续跑。",
|
||||
"description": "人工复核决策。task_id 与 conversation_id 至少传一个;用户确认时禁止 create_task。决策提交后由 hxops worker 统一续跑。",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
@@ -688,11 +369,12 @@
|
||||
},
|
||||
"decision": {
|
||||
"type": "string",
|
||||
"description": "confirm=确认继续;reject=驳回;rematch=重新匹配;reparse=重新解析;confirm_inventory_mapping=确认库存字段对齐;correct_inventory_mapping=更正列映射;reparse_inventory=重新上传库存",
|
||||
"description": "confirm=确认继续;reject=驳回;retry_rpa=重试 RPA 库存导出;rematch=重新匹配;reparse=重新解析;confirm_inventory_mapping=确认库存字段对齐;correct_inventory_mapping=更正列映射;reparse_inventory=重新上传库存",
|
||||
"enum": [
|
||||
"confirm",
|
||||
"confirm_parse",
|
||||
"reject",
|
||||
"retry_rpa",
|
||||
"rematch",
|
||||
"reparse",
|
||||
"confirm_inventory_mapping",
|
||||
@@ -726,97 +408,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/generate_shipment_excel": {
|
||||
"post": {
|
||||
"operationId": "generate_shipment_excel",
|
||||
"summary": "生成固定模板发货 Excel(须 match_inventory 成功且 process_status=matched)",
|
||||
"description": "生成固定模板发货 Excel(须 match_inventory 成功且 process_status=matched)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
}
|
||||
},
|
||||
"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/upload_to_freight": {
|
||||
"post": {
|
||||
"operationId": "upload_to_freight",
|
||||
"summary": "上传 Excel 到货代系统(RPA 或手工确认)",
|
||||
"description": "上传 Excel 到货代系统(RPA 或手工确认)",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string",
|
||||
"description": "auto=触发 RPA;retry_upload=重试;manual_confirm=手工上传完成",
|
||||
"enum": [
|
||||
"auto",
|
||||
"retry_upload",
|
||||
"manual_confirm"
|
||||
]
|
||||
},
|
||||
"freight_ref_no": {
|
||||
"type": "string",
|
||||
"description": "货代系统单号(可选;manual_confirm 通常无需填写)"
|
||||
}
|
||||
},
|
||||
"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/get_task_status": {
|
||||
"post": {
|
||||
"operationId": "get_task_status",
|
||||
@@ -895,53 +486,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/tools/switch_focus_task": {
|
||||
"post": {
|
||||
"operationId": "switch_focus_task",
|
||||
"summary": "切换当前批次的聚焦任务",
|
||||
"description": "切换当前批次的聚焦任务",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"batch_no": {
|
||||
"type": "string",
|
||||
"description": "发货批次编号(batch id),如 SB-20260617-ABCD1234"
|
||||
},
|
||||
"task_no": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
},
|
||||
"target_task_no": {
|
||||
"type": "string",
|
||||
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"batch_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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user