fix(engine): 非中/西语轮注入 other 语言提醒——英文漂中文镜像修复(Task 11 对向)
历史护栏: 中文/西语会话纯拉丁轮不注入(护住 Task 11 场景);wall other 为 可选变体(存量快照/auto/生成器回退 DEFAULT_WALL,引擎部署即全租户生效) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -496,10 +496,32 @@ def test_reminder_language_note_follows_customer_language():
|
||||
assert "跟随客户语言自然表达" in es
|
||||
assert "号码逐字照抄" in es
|
||||
assert "英文原版" not in es and "绝不翻译" not in es # 旧规则清零
|
||||
# 英文客户不带语言提醒(默认英语,无需提醒)
|
||||
# 2026-11-03 修正: 英文轮注入 other 语言提醒(默认英语方向此前无当轮
|
||||
# 强制,system.md 压不住——中文语境+短英文查询整轮漂中文,与 Task 11
|
||||
# 中文漂英文同款机理的镜像)
|
||||
en = ConversationManager._build_context_reminder(
|
||||
{}, "how much is the DN800 pipe?", [])
|
||||
assert "语言提醒" in en and "不要出现汉字" in en
|
||||
assert "全程使用中文" not in en and "西语" not in en
|
||||
|
||||
|
||||
def test_language_note_other_history_guard():
|
||||
"""2026-11-03 历史护栏: 中文/西语会话中的纯拉丁轮(DN800/ok/型号)
|
||||
维持无注入——历史语言自然延续;无条件注入 other 会把 Task 11 修好的
|
||||
中文规格混排场景反向掰成英文。护栏只看客户消息(role=user)。"""
|
||||
zh_hist = [{"role": "user", "content": "你们做DN800的HDPE双壁波纹管吗"},
|
||||
{"role": "assistant", "content": "做的,您大概需要多少?"},
|
||||
{"role": "user", "content": "300米"}]
|
||||
r = ConversationManager._build_context_reminder({}, "DN800", zh_hist)
|
||||
assert "语言提醒" not in r # 中文会话纯拉丁轮: 不注入(现状保持)
|
||||
es_hist = [{"role": "user", "content": "¿Cuál es el precio?"},
|
||||
{"role": "assistant", "content": "Depende de la especificación"}]
|
||||
r2 = ConversationManager._build_context_reminder({}, "DN110", es_hist)
|
||||
assert "语言提醒" not in r2 # 西语会话纯拉丁轮: 同护栏
|
||||
en_hist = [{"role": "user", "content": "how much for PE100?"},
|
||||
{"role": "assistant", "content": "Need your specs first"}]
|
||||
r3 = ConversationManager._build_context_reminder({}, "DN800", en_hist)
|
||||
assert "语言提醒" in r3 # 纯英文会话: 照常注入
|
||||
# 有画像时同样生效(挂 parts 尾部)
|
||||
zh2 = ConversationManager._build_context_reminder(
|
||||
{"意向品类": "波纹管"}, "多少钱一米?", [])
|
||||
|
||||
Reference in New Issue
Block a user