feat(shipping-notice): 增强发货通知候选管理功能,支持候选选择、重复检测与业务摘要修订
This commit is contained in:
1 parent
70f684b94a
commit
b595e157e9
83 files changed
+5857
-200
No files matched your search
@@ -9,6 +9,7 @@ backend/app/services/shipping_notice/runtime_context.py
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from app.models import ShippingBatch, ShippingTask
|
||||
@@ -74,6 +75,9 @@ def _build_refs(
|
||||
task: ShippingTask | None,
|
||||
batch: ShippingBatch | None,
|
||||
run_purpose: str | None,
|
||||
intake_nos: list[str] | None = None,
|
||||
capability: str | None = None,
|
||||
contract_version: str | None = None,
|
||||
) -> dict[str, str]:
|
||||
"""
|
||||
构建新版 agent_runtime_context.refs。
|
||||
@@ -84,6 +88,9 @@ def _build_refs(
|
||||
task: 当前任务。
|
||||
batch: 当前批次。
|
||||
run_purpose: 本次 Dify run 的目的。
|
||||
intake_nos: 点击发送时锁定的 Intake 编号集合。
|
||||
capability: 当前固定画布能力,如 order_extraction。
|
||||
contract_version: 能力输入输出契约版本。
|
||||
|
||||
Returns:
|
||||
非空业务锚点字典。
|
||||
@@ -101,6 +108,13 @@ def _build_refs(
|
||||
refs["run_purpose"] = normalized_run_purpose
|
||||
if file_name:
|
||||
refs["file_name"] = file_name
|
||||
normalized_intakes = sorted({str(item or '').strip().upper() for item in (intake_nos or []) if str(item or '').strip()})
|
||||
if normalized_intakes:
|
||||
refs["intake_nos"] = json.dumps(normalized_intakes, ensure_ascii=False, separators=(",", ":"))
|
||||
if _clean_text(capability):
|
||||
refs["capability"] = _clean_text(capability)
|
||||
if _clean_text(contract_version):
|
||||
refs["contract_version"] = _clean_text(contract_version)
|
||||
return refs
|
||||
|
||||
|
||||
@@ -196,6 +210,9 @@ def build_shipping_runtime_context(
|
||||
locale: str | None = None,
|
||||
scope: str = "task_run",
|
||||
run_purpose: str | None = None,
|
||||
intake_nos: list[str] | None = None,
|
||||
capability: str | None = None,
|
||||
contract_version: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
构建货代发货通知 Agent 的 agent_runtime_context。
|
||||
@@ -212,6 +229,9 @@ def build_shipping_runtime_context(
|
||||
locale: 用户语言。
|
||||
scope: 上下文作用域。
|
||||
run_purpose: 本次 Dify run 的目的,如 parse_notice。
|
||||
intake_nos: 尚未建 Task 时的 Intake 编号集合。
|
||||
capability: 当前固定画布能力。
|
||||
contract_version: 能力契约版本。
|
||||
|
||||
Returns:
|
||||
agent_runtime_context 字典;session_id 为空时返回空 dict。
|
||||
@@ -233,7 +253,14 @@ def build_shipping_runtime_context(
|
||||
request_id=request_id,
|
||||
trigger_source=trigger_source,
|
||||
locale=locale,
|
||||
refs=_build_refs(task=task, batch=batch, run_purpose=run_purpose),
|
||||
refs=_build_refs(
|
||||
task=task,
|
||||
batch=batch,
|
||||
run_purpose=run_purpose,
|
||||
intake_nos=intake_nos,
|
||||
capability=capability,
|
||||
contract_version=contract_version,
|
||||
),
|
||||
domain=domain,
|
||||
reference_context=reference_context,
|
||||
)
|
||||
Reference in new issue
Block a user