转人工协同按运输方式各自落地:海运说转人工直接建正式单建群发摘要和空白表,陆运先选业务类型和报价场景再建群,空运先落正式单让销售把工单号发进原群,转人工后群里报价不再被当成冻结单拦住。产品报价只发摘要和成交卡,要 Excel/PDF 说「生成报价单」再出,多段逐段出、没价出空白表,出表后补推成交跟进不涨版本、不重置等待计时。结束询价口令不再进模型,直接清上下文。卡片回执按本次入站消息号去重,第二次点提交不会再被静默吞掉。陆转人工按选定模板名直取,避免陆运七种业务靠关键词猜错;空运舱位只回一条时直接出价,TMS 分桶费用落到对应段。后台工单补需求字段与模板预览样例,新增 AIR_NEED_WO 回复语、协同模式、陆运岗位与陆运超时卡迁移脚本;测服文档改为独立企微应用 1000015。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,6 +47,8 @@ class MemoryTicket:
|
||||
status: str = "询价中"
|
||||
quote: dict[str, Any] = field(default_factory=dict)
|
||||
quote_version: int = 0
|
||||
biz_type_label: str = ""
|
||||
collab_mode: str = "auto"
|
||||
collab_chat_id: str = ""
|
||||
collab_facts: dict[str, str] = field(default_factory=dict)
|
||||
collab_member_ids: list[str] = field(default_factory=list)
|
||||
@@ -156,6 +158,8 @@ class MemoryLedger:
|
||||
business_line: str,
|
||||
facts: dict[str, str],
|
||||
idempotency_key: str = "",
|
||||
biz_type_label: str = "",
|
||||
collab_mode: str = "",
|
||||
) -> dict[str, Any]:
|
||||
_ = idempotency_key
|
||||
# 出询价确认必须新开一单,相同需求不复用未关闭工单
|
||||
@@ -168,6 +172,8 @@ class MemoryLedger:
|
||||
business_line=business_line,
|
||||
facts=dict(facts),
|
||||
fingerprint=fp,
|
||||
biz_type_label=(biz_type_label or "").strip(),
|
||||
collab_mode=(collab_mode or "auto").strip() or "auto",
|
||||
)
|
||||
self._tickets[no] = ticket
|
||||
similar = self.find_similar_open(
|
||||
@@ -300,6 +306,7 @@ class MemoryLedger:
|
||||
return {
|
||||
"ok": True,
|
||||
"quote_version": ticket.quote_version,
|
||||
"quote_id": f"{work_order_no}-Q{ticket.quote_version}",
|
||||
"status": ticket.status,
|
||||
}
|
||||
|
||||
@@ -428,10 +435,12 @@ class MemoryLedger:
|
||||
format: str = "xlsx",
|
||||
sales_wecom_id: str = "",
|
||||
persist_attachment: bool = False,
|
||||
template_name: str = "",
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
按询价需求匹配内存模板。不填真实 xlsx,只回假字节供流程/单测。
|
||||
persist_attachment 与主账同语义:True 表示应登记附件(单测可断言 attachmentSaved)。
|
||||
template_name:转人工卡片指定的模板名,优先于关键词匹配。
|
||||
"""
|
||||
from agent.quote_templates.match import FAIL_MESSAGE, pick_quote_template
|
||||
|
||||
@@ -443,6 +452,7 @@ class MemoryLedger:
|
||||
business_line=business_line,
|
||||
facts=facts,
|
||||
quote=quote,
|
||||
template_name=template_name,
|
||||
)
|
||||
if picked is None:
|
||||
out = {"ok": False, "error": "NO_TEMPLATE", "message": FAIL_MESSAGE, "facts": dict(facts or {})}
|
||||
@@ -701,6 +711,7 @@ class MemoryLedger:
|
||||
member_ids: list[str],
|
||||
product_names: list[str] | None = None,
|
||||
product_ids: list[str] | None = None,
|
||||
collab_mode: str = "",
|
||||
) -> dict[str, Any]:
|
||||
"""记下协同群和产品姓名,不改六态。重启后群摘要还要靠这些名字 @ 到人。"""
|
||||
with self._lock:
|
||||
@@ -714,6 +725,8 @@ class MemoryLedger:
|
||||
ticket.collab_member_ids = [str(x) for x in member_ids]
|
||||
ticket.product_ids = [str(x) for x in (product_ids or [])]
|
||||
ticket.product_names = [str(x).strip() for x in (product_names or []) if str(x).strip()]
|
||||
if (collab_mode or "").strip():
|
||||
ticket.collab_mode = collab_mode.strip()
|
||||
return {"ok": True, "chat_id": ticket.collab_chat_id}
|
||||
|
||||
def end_collab_group(self, *, work_order_no: str) -> dict[str, Any]:
|
||||
@@ -777,12 +790,24 @@ class MemoryLedger:
|
||||
to_status: str = "已报价",
|
||||
remark: str = "",
|
||||
kind: str = "",
|
||||
raw_text: str = "",
|
||||
raw_source: str = "",
|
||||
) -> dict[str, Any]:
|
||||
"""手工报价 / 销售调价盖 TMS 价。remark/kind 只给 HTTP 主账记流水。"""
|
||||
_ = remark, kind
|
||||
return self.upsert_quote(
|
||||
out = self.upsert_quote(
|
||||
work_order_no=work_order_no, quote=quote, to_status=to_status
|
||||
)
|
||||
# 单测里也要能回看产品原话;主账落 inq_quote.raw_text,内存票落在 quote 快照。
|
||||
if out.get("ok") and (raw_text or raw_source):
|
||||
with self._lock:
|
||||
ticket = self._tickets.get(work_order_no)
|
||||
if ticket is not None:
|
||||
if raw_text:
|
||||
ticket.quote["raw_text"] = raw_text
|
||||
if raw_source:
|
||||
ticket.quote["raw_source"] = raw_source
|
||||
return out
|
||||
|
||||
def patch_collab_facts(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user