feat: 再索要墙渠道精确化——索要缺失渠道放行(双要前置)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-08 11:24:45 +08:00
parent 7c4f8eb4da
commit 1fc87fbe85
4 changed files with 89 additions and 12 deletions
+10 -5
View File
@@ -207,8 +207,12 @@ class ConversationManager:
# 方案B'(13.7): 句子粒度门控——干净句子逐句流出(恢复打字机),
# 违规句永不流出:已流出内容全部干净,违规时接过渡话术收尾并掐断生成。
# F6(D6联动): 客户已留联系方式时,收尾话术不得再索要——路由 contact 版
has_contact = bool(split_validate(
normalize_contacts(effective_raw.get("联系方式")))[0])
# 渠道精确化(2026-10-08): confirmed 渠道集合传给再索要墙——
# 索要缺失渠道(如已有 phone 问邮箱)放行,是 Task 3 邮箱轻补的前提
_confirmed_contacts, _ = split_validate(
normalize_contacts(effective_raw.get("联系方式")))
has_contact = bool(_confirmed_contacts)
_confirmed_channels = set(_confirmed_contacts)
yield {"type": "stream_start"}
emitted = ""
@@ -235,8 +239,9 @@ class ConversationManager:
violation = "no_contact"
break
# Task 5b 再索要墙: 已留资时索要句静默丢弃(丢句不掐断,
# 其余句子照常流出——软于两墙的掐断+替换)
if has_contact and asks_contact(sentence):
# 其余句子照常流出——软于两墙的掐断+替换);
# 渠道精确化: 只丢索要已在手渠道的句子
if has_contact and asks_contact(sentence, _confirmed_channels):
logger.warning("Re-ask wall dropped sentence (conv=%s): %r",
conv.id, sentence[:60])
dropped_ask = True
@@ -255,7 +260,7 @@ class ConversationManager:
violated = True
dirty = pending
violation = "no_contact"
elif has_contact and asks_contact(pending):
elif has_contact and asks_contact(pending, _confirmed_channels):
# Task 5b 再索要墙: 尾巴是索要句 → 静默丢弃(不流出不掐断)
logger.warning("Re-ask wall dropped tail (conv=%s): %r",
conv.id, pending[:60])