checkpoint: 提交当前工作区代码(同义词配置初版 + 既有流程改动)

- 新增 inq_synonym 表、62组同义词种子与智能体只读接口
- Python 同义词加载/归一化与 1板/2箱 机读
- 同步当前分支既有协作、报价识别、陆运等改动
This commit is contained in:
linmianxun
2026-11-24 16:26:49 +08:00
parent d9b2029c47
commit 04e00f0cfc
69 changed files with 7126 additions and 395 deletions
+9
View File
@@ -112,6 +112,15 @@ class LedgerApiShell:
"""
return self.client.request_json("GET", "/inquiry/agent/botReply/listEnabled")
def list_synonyms(self) -> LedgerResponse:
"""
已启用询价同义词。
正式路径:GET /inquiry/agent/synonym/listEnabled
只读;IT 在 inq_synonym 维护,停用项不在列表里。
"""
return self.client.request_json("GET", "/inquiry/agent/synonym/listEnabled")
def wake_agent_ack(
self,
*,
@@ -648,12 +648,15 @@ class HttpLedger:
kind: str = "",
raw_text: str = "",
raw_source: str = "",
sender_id: str = "",
) -> dict[str, Any]:
"""
手工报价 / 销售调价写入主账新版本。
幂等键带合计和备注,避免连续调价被同一把钥匙吞掉。
raw_text:产品群内原话,主账只留档参考,不参与金额解析。
sender_id:本次报价人企微 userid。主账据此记「处理人」互动快照,
转人工拉群时只被拉进来、没报价的人不该出现在处理人列。
"""
src = dict(quote or {})
note = (remark or "").strip()
@@ -662,6 +665,8 @@ class HttpLedger:
"quote": src,
"toStatus": to_status,
}
if (sender_id or "").strip():
body["senderWecomId"] = sender_id.strip()
if note:
body["remark"] = note
if (kind or "").strip():
+10 -2
View File
@@ -52,6 +52,8 @@ class MemoryTicket:
collab_chat_id: str = ""
collab_facts: dict[str, str] = field(default_factory=dict)
collab_member_ids: list[str] = field(default_factory=list)
# 有报价/补字段等互动的产品/航线;处理人列只认这份,不认全部群成员。
collab_actor_ids: list[str] = field(default_factory=list)
product_ids: list[str] = field(default_factory=list)
product_names: list[str] = field(default_factory=list)
collab_ended: bool = False
@@ -792,6 +794,7 @@ class MemoryLedger:
kind: str = "",
raw_text: str = "",
raw_source: str = "",
sender_id: str = "",
) -> dict[str, Any]:
"""手工报价 / 销售调价盖 TMS 价。remark/kind 只给 HTTP 主账记流水。"""
_ = remark, kind
@@ -799,7 +802,7 @@ class MemoryLedger:
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):
if out.get("ok") and (raw_text or raw_source or sender_id):
with self._lock:
ticket = self._tickets.get(work_order_no)
if ticket is not None:
@@ -807,6 +810,9 @@ class MemoryLedger:
ticket.quote["raw_text"] = raw_text
if raw_source:
ticket.quote["raw_source"] = raw_source
uid = (sender_id or "").strip()
if uid and uid not in ticket.collab_actor_ids:
ticket.collab_actor_ids.append(uid)
return out
def patch_collab_facts(
@@ -817,11 +823,13 @@ class MemoryLedger:
sender_id: str = "",
) -> dict[str, Any]:
"""合并协同字段。不改六态、不写报价版本。"""
_ = sender_id
with self._lock:
ticket = self._tickets.get(work_order_no)
if ticket is None:
return {"ok": False, "error": "ticket_not_found"}
uid = (sender_id or "").strip()
if uid and uid not in ticket.collab_actor_ids:
ticket.collab_actor_ids.append(uid)
for key, raw in (facts or {}).items():
name = str(key or "").strip()
if not name: