non-speaking bots still see messages for context (read-only LLM injection)

This commit is contained in:
2026-06-20 19:07:50 +08:00
parent 90429116c7
commit aabec04d8a
+8 -1
View File
@@ -168,7 +168,14 @@ class AgentBot(ClientXMPP):
self._granted = None self._granted = None
if not _can_speak: if not _can_speak:
return # 代码层拦截,不走 LLM # 无权发言 → 仍发给 LLM 用于上下文积累,但标记为只读
_room = sender.split('/')[0]
_readonly_body = (
"【只读消息】你不需要回复,只需了解内容以便后续上下文连贯。输出 __SILENT__。\n\n"
f"[核心群 {_room}] {nickname} 说: {body}"
)
await self.call_hermes(_readonly_body, sender, is_group=True)
return
# 硬闭嘴闸门:hmo 说闭嘴类的话 → 静默 5 分钟 # 硬闭嘴闸门:hmo 说闭嘴类的话 → 静默 5 分钟
_silent_until = getattr(self, '_silent_until', 0) _silent_until = getattr(self, '_silent_until', 0)