机器人显示名与站点标题可配;多段联运列表投影;协同群监听对账;工单附件落存;模板与工单后台补强

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-19 09:41:59 +08:00
co-authored by Cursor
parent 277cdc1c28
commit 2b528758b4
119 changed files with 6760 additions and 3516 deletions
+20 -1
View File
@@ -58,11 +58,24 @@ def fill(template: str, values: dict[str, Any] | None = None) -> str:
return _PLACEHOLDER.sub(_repl, template or "")
def lookup_raw(code: str) -> str:
"""
按调用编码取原文模板(不填变量)。
供显示名等短配置读取;空串表示停用/未配。走同一份短缓存。
"""
key = (code or "").strip()
if not key:
return ""
return _lookup(key)
def render(code: str, default: str, **kwargs: Any) -> str:
"""
取已启用回复语并填变量。
停用、库空、主账失败、编码对不上:返回 default(已是拼好的默认句)。
自动注入 {{bot_name}}(企微机器人显示名),调用方可不传。
副作用:缓存过期时 GET 主账;超时/失败吞掉,不抛给销售。
"""
key = (code or "").strip()
@@ -72,7 +85,13 @@ def render(code: str, default: str, **kwargs: Any) -> str:
tpl = _lookup(key)
if not (tpl or "").strip():
return fallback
return fill(tpl, kwargs)
values = dict(kwargs)
if "bot_name" not in values:
# 延迟导入,避免与 bot_name → lookup_raw 循环在模块加载期炸。
from agent.policy.bot_name import bot_display_name
values["bot_name"] = bot_display_name()
return fill(tpl, values)
def _lookup(code: str) -> str: