add silent phrase interception: block LLM announcing silence instead of being silent
This commit is contained in:
@@ -193,6 +193,12 @@ class AgentBot(ClientXMPP):
|
||||
if reply_stripped.startswith('__SILENT__') or reply_stripped.startswith('`__SILENT__`'):
|
||||
logging.info(f"⏭️ {AGENT_NAME} 决定沉默,不发送")
|
||||
return
|
||||
# 额外拦截:LLM 说"我沉默""我不说了"等宣布沉默的话→当 SILENT 处理
|
||||
_silent_phrases = ['我沉默', '我不说', '不说了', '不回复', '不插嘴', '我闭嘴',
|
||||
'闭嘴上', '沉默是', '彻底沉默', '我会沉默', '将保持沉默']
|
||||
if any(p in reply for p in _silent_phrases):
|
||||
logging.info(f"⏭️ {AGENT_NAME} 宣布沉默(命中关键词),拦截")
|
||||
return
|
||||
finish = data.get("choices", [{}])[0].get("finish_reason", "")
|
||||
|
||||
if reply.strip() and finish != "silent":
|
||||
|
||||
Reference in New Issue
Block a user