落地多段联运私聊:齐了才建单拉群,附件只收格子值,核对改正不再整单重开。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-23 15:08:15 +08:00
co-authored by Cursor
parent 6e3e09a316
commit 2334524bb8
30 changed files with 4033 additions and 40 deletions
+57 -2
View File
@@ -219,6 +219,9 @@ _LAND_EXAMPLES = {
"毛重": "50kg",
"车型/数量": "9米6/1",
"通关口岸": "皇岗",
"运输类型": "国内运输拼车",
"线路类别": "国内长途/零担",
"运输分类": "急件",
}
@@ -321,13 +324,17 @@ def ask_land_fields(
报价日期不进待补充。
"""
src = dict(facts or {})
skip = {"报价日期", "运输类型", "线路类别", "运输分类"}
skip = {"报价日期"}
missing = [k for k in missing_keys if k and k not in skip]
land_type = (land_subtype or src.get("运输类型") or "").strip()
optional = _land_optional_keys(land_type)
lines = ["请确认并补充以下信息:", "运输方式:陆运"]
if land_type:
lines.append(f"运输类型:{land_type}")
for key in ("线路类别", "运输分类"):
val = (src.get(key) or "").strip()
if val:
lines.append(_land_field_line(key, val, required=True))
for key in _land_cargo_keys(land_type, src):
val = (src.get(key) or "").strip()
if val:
@@ -373,7 +380,9 @@ def _air_known_value(facts: dict[str, str], key: str) -> str:
return (src.get("包装方式") or src.get("包装类型") or "").strip()
if key == "报价日期":
return (src.get("报价日期") or "").strip()
return (src.get(key) or "").strip()
from agent.llm.extract_text import clip_inquiry_value
return clip_inquiry_value(src.get(key) or "")
def _sea_known_value(facts: dict[str, str], key: str) -> str:
@@ -1483,6 +1492,52 @@ def sea_tms_miss_wecom_payload(*, work_order_no: str, action_url: str = "") -> d
return {"msgtype": "template_card", "template_card": card}
MULTI_CONFIRM_TAIL = "请回复「确定」创建工单,内容有误时,请重新发内容。"
MULTI_SAME_MODE = "同一运输方式出现了两段,请拆开再发。"
MULTI_CONFIRM_EXPIRED = "刚才的多段核对已过期,请把多段需求再发一次,出核对后再回复确定。"
def multi_air_manual_hint(*, work_order_no: str) -> str:
"""含空运的多段:不自动拉群,请销售把人和智能体拉进原有群并发送工单号。"""
no = (work_order_no or "").strip()
return f"请手动拉相关人员和智能体到原有群,并在群聊发送工单编号{no}"
def multi_pull_text(*, work_order_no: str) -> str:
"""不含空运:建单后的拉群文字兜底。不写 TMS、不写暂无报价。"""
no = (work_order_no or "").strip()
return "\n".join(
[
f"询价工单 {no}",
"工单已创建。",
"是否拉产品人员进群协同?",
BTN_PULL_COLLAB,
]
)
def multi_pull_wecom_payload(*, work_order_no: str) -> dict[str, Any]:
"""不含空运:一张卡、一个按钮,点下去才按各段线路建群。"""
no = (work_order_no or "").strip()
return {
"msgtype": "template_card",
"template_card": {
"card_type": "button_interaction",
"source": {"desc": "多段联运", "desc_color": 0},
"main_title": {"title": f"询价工单 {no}", "desc": "工单已创建。"},
"sub_title_text": "是否拉产品人员进群协同?",
"task_id": card_task_id("multi_pull", no or "multi"),
"button_list": [
{
"text": BTN_PULL_COLLAB,
"style": 1,
"key": f"{BTN_PULL_COLLAB_KEY}:{no}",
}
],
},
}
def handoff_air_hint(*, work_order_no: str) -> str:
"""空运转人工:只发文字,不建群。"""
no = (work_order_no or "").strip()