feat(shipping_notice): 完成货代发货通知全流程功能迭代与重构
主要变更: 1. 移除废弃的发货通知字段抽取独立Workflow Agent相关代码 2. 重构Dify服务调用,新增inputs参数支持注入环境变量配置的工具API地址与密钥 3. 新增auto_progress工具API与checkpoint catalog接口,支持流程自动推进 4. 统一字段命名,将column_mapping_json改为map_json并兼容旧有调用 5. 重构库存匹配、解析结果的展示格式,改为标准化多语言Markdown表格 6. 新增ODM ID库存字段支持,优化库存解析与映射逻辑 7. 新增LibreOffice转换隔离Profile配置,避免多实例运行冲突 8. 新增完整环境变量配置、数据库迁移脚本与测试用例 9. 适配前端代码,更新字段命名与聊天跳转逻辑 10. 更新OpenAPI规范适配Dify工具调用,删除已归档的旧部署文档
This commit is contained in:
1 parent
2ce5256483
commit
c18c0394d0
50 files changed
+6088
-2407
No files matched your search
@@ -2,6 +2,8 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from app.services.shipping_notice.constants import MAP_JSON
|
||||
|
||||
|
||||
def _str_prop(description: str, *, enum: list[str] | None = None) -> dict[str, Any]:
|
||||
prop: dict[str, Any] = {"type": "string", "description": description}
|
||||
@@ -40,7 +42,10 @@ def _post_op(
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Tool response (status: ok|running|needs_human|failed)",
|
||||
"description": (
|
||||
"Tool response (status: ok|running|needs_human|failed). "
|
||||
"May include checkpoint, human_options, action_buttons."
|
||||
),
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {"type": "object"},
|
||||
@@ -100,7 +105,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"true=解析该任务已上传的 Excel(服务端直传,不经过 LLM)",
|
||||
enum=["true", "false"],
|
||||
),
|
||||
"column_mapping_json": _str_prop(
|
||||
MAP_JSON: _str_prop(
|
||||
'可选,列映射 JSON 字符串,如 {"sku":"AWS Sku","available_qty":"Qty Available"}'
|
||||
),
|
||||
"raw_inventory_text": _str_prop(
|
||||
@@ -123,11 +128,11 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"应用 LLM/人工列映射并解析完整库存文件;返回 field_alignment 等待用户确认",
|
||||
{
|
||||
"task_id": task_id,
|
||||
"column_mapping_json": _str_prop(
|
||||
MAP_JSON: _str_prop(
|
||||
'列映射 JSON,含 sku/reservation_id/available_qty;可选 match_rule(LLM 自然语言匹配说明,缺省则后端动态兜底)'
|
||||
),
|
||||
},
|
||||
required=["task_id", "column_mapping_json"],
|
||||
required=["task_id", MAP_JSON],
|
||||
),
|
||||
"/tools/ensure_inventory": _post_op(
|
||||
"ensure_inventory",
|
||||
@@ -141,6 +146,14 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
},
|
||||
required=["task_id"],
|
||||
),
|
||||
"/tools/auto_progress": _post_op(
|
||||
"auto_progress",
|
||||
"按后端全局配置自动推进:RPA 获取库存 → 字段对齐(满足条件可自动确认)→ 匹配 → 生成 Excel →(可选)上传。遇到人工节点会停住返回 action_buttons。",
|
||||
{
|
||||
"task_id": task_id,
|
||||
"conversation_id": _str_prop("Dify 会话 ID(可选,用于仅知道会话时定位任务)"),
|
||||
},
|
||||
),
|
||||
"/tools/match_inventory": _post_op(
|
||||
"match_inventory",
|
||||
"匹配发货需求与库存。前置条件:submit_decision(confirm_inventory_mapping) 已成功;"
|
||||
@@ -190,7 +203,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
|
||||
"auto=触发 RPA;retry_upload=重试;manual_confirm=手工上传完成",
|
||||
enum=["auto", "retry_upload", "manual_confirm"],
|
||||
),
|
||||
"freight_ref_no": _str_prop("货代系统单号(manual_confirm 时填写)"),
|
||||
"freight_ref_no": _str_prop("货代系统单号(可选;manual_confirm 通常无需填写)"),
|
||||
},
|
||||
required=["task_id"],
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user