feat(shipping-notice): 添加订单抽取功能,支持异步运行和管理,优化相关数据模型和处理逻辑

This commit is contained in:
hugo committed 2026-07-21 09:02:42 +08:00
1 parent 34d489a2d1
commit ce26d6d0c4
144 files changed
+12241 -4233

No files matched your search

+1 -32
View File
@@ -2,7 +2,7 @@
services/shipping_notice/tools.py
用途:发货通知 Agent Tool 统一门面(API 唯一业务入口,无编排实现)。
依赖:customer_identity_gate、task_workflow、inventory_workflow、inventory_rpa_workflow、fulfillment_workflow;order_extraction 延迟导入以避免建批循环依赖。
依赖:customer_identity_gate、task_workflow、inventory_workflow、inventory_rpa_workflow、fulfillment_workflow。
逻辑:shipping_notice_tools / workspace_shipping_notice 仅 import 本模块公开符号。
"""
@@ -17,37 +17,6 @@ from app.services.shipping_notice import (
from app.services.shipping_notice import customer_identity_gate
def get_order_extraction_context(payload: dict):
"""
返回点击发送后的完整订单抽取上下文。
【AI 触发时机】:仅在 Dify 订单抽取固定分支的 LLM 节点之前调用。
核心逻辑:延迟导入实现,避免 batch_from_intakes 与 Tool 门面形成模块初始化环。
Args:
payload: 必须包含完整 agent_runtime_context。
Returns:
邮件/附件文本、输入快照与抽取契约。
"""
from app.services.shipping_notice.order_extraction import get_order_extraction_context as _get
return _get(payload)
def submit_order_extraction(payload: dict):
"""
提交 LLM 完整订单结果并执行自动建单。
【AI 触发时机】:订单抽取 LLM 与 JSON 标准化节点成功后调用。
核心逻辑:延迟导入实现,保留 Tool 门面为唯一 API 业务入口且不引入建批循环依赖。
Args:
payload: 完整运行态上下文、输入快照、契约版本与 orders[]。
Returns:
自动建单、打开已有任务和待处理订单摘要。
"""
from app.services.shipping_notice.order_extraction import submit_order_extraction as _submit
return _submit(payload)
# 任务 / 批次 / 决策
create_batch = task_workflow.create_batch
create_batch_tasks = task_workflow.create_batch_tasks