feat(shipping-notice): 实现货代发货通知的库存全流程与对话交互

This commit is contained in:
hugo committed 2026-06-03 11:09:46 +08:00
1 parent a5cc48b6aa
commit 2607f4a9f6
26 files changed
+5013 -256

No files matched your search

+158 -69
View File
@@ -7,22 +7,7 @@
},
"servers": [
{
"url": "http://192.168.100.192:8890/api/shipping-notice"
}
],
"components": {
"securitySchemes": {
"ShippingToolKey": {
"type": "apiKey",
"in": "header",
"name": "X-Shipping-Tool-Key",
"description": "与 hxops SHIPPING_NOTICE_TOOL_API_KEY 相同"
}
}
},
"security": [
{
"ShippingToolKey": []
"url": "http://127.0.0.1:5052/api/shipping-notice"
}
],
"paths": {
@@ -77,12 +62,7 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
},
"/tools/parse_notice": {
@@ -125,19 +105,156 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
}
},
"/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": {
"case_id": {
"type": "string",
"description": "发货任务编号,如 SN-20260529-ABCD1234"
},
"use_uploaded_file": {
"type": "string",
"description": "true=解析该 case 已上传的 Excel(服务端直传,不经过 LLM)",
"enum": [
"true",
"false"
]
},
"column_mapping_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": [
"case_id"
]
}
}
}
]
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed)",
"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 推断列映射)",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"case_id": {
"type": "string",
"description": "发货任务编号,如 SN-20260529-ABCD1234"
}
},
"required": [
"case_id"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed)",
"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": {
"case_id": {
"type": "string",
"description": "发货任务编号,如 SN-20260529-ABCD1234"
},
"column_mapping_json": {
"type": "string",
"description": "列映射 JSON,如 {\"sku\":\"料号\",\"reservation_id\":\"COM ID\",\"available_qty\":\"Qty Available\"}"
}
},
"required": [
"case_id",
"column_mapping_json"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed)",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/ensure_inventory": {
"post": {
"operationId": "ensure_inventory",
"summary": "确保库存快照可用(RPA 或手工 JSON)",
"description": "确保库存快照可用(RPA 或手工 JSON)",
"summary": "确保库存快照可用(RPA 自动导出;对话库存请优先用 parse_inventory)",
"description": "确保库存快照可用(RPA 自动导出;对话库存请优先用 parse_inventory)",
"parameters": [],
"requestBody": {
"required": true,
@@ -181,19 +298,14 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
},
"/tools/match_inventory": {
"post": {
"operationId": "match_inventory",
"summary": "匹配发货需求与库存",
"description": "匹配发货需求与库存",
"summary": "匹配发货需求与库存。前置条件:submit_decision(confirm_inventory_mapping) 已成功;未确认时调用会被拒绝并返回 forbidden_next_tools",
"description": "匹配发货需求与库存。前置条件:submit_decision(confirm_inventory_mapping) 已成功;未确认时调用会被拒绝并返回 forbidden_next_tools",
"parameters": [],
"requestBody": {
"required": true,
@@ -229,12 +341,7 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
},
"/tools/submit_decision": {
@@ -256,12 +363,14 @@
},
"decision": {
"type": "string",
"description": "confirm=确认继续;reject=驳回;rematch=重新匹配;reparse=重新解析",
"description": "confirm=确认继续;reject=驳回;rematch=重新匹配;reparse=重新解析;confirm_inventory_mapping=确认库存字段对齐;reparse_inventory=重新上传库存",
"enum": [
"confirm",
"reject",
"rematch",
"reparse"
"reparse",
"confirm_inventory_mapping",
"reparse_inventory"
]
},
"comment": {
@@ -288,12 +397,7 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
},
"/tools/generate_shipment_excel": {
@@ -332,12 +436,7 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
},
"/tools/upload_to_freight": {
@@ -389,12 +488,7 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
},
"/tools/get_case_status": {
@@ -433,12 +527,7 @@
}
}
}
},
"security": [
{
"ShippingToolKey": []
}
]
}
}
}
}