tighten ai_auto_response participation and spam guard
This commit is contained in:
@@ -130,6 +130,7 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
||||
self.cooldown_config = self._config.get("cooldown", {}) or {}
|
||||
self.cooldown = CooldownManager(self.cooldown_config)
|
||||
self.image_config = self._config.get("image", {}) or {}
|
||||
self.spam_config = self._config.get("spam_guard", {}) or {}
|
||||
self._synced_member_context_versions: Dict[str, str] = {}
|
||||
self.log_debug = bool((self._config.get("logging", {}) or {}).get("debug", True))
|
||||
self.LOG.debug(f"[{self.name}] 初始化完成")
|
||||
@@ -197,6 +198,23 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
||||
reply_mode="defense",
|
||||
)
|
||||
return False, "ignored_prompt_attack"
|
||||
if self.dedup.should_skip_repeated_room_content(
|
||||
room_id=room_id,
|
||||
content=content,
|
||||
window_sec=int(self.spam_config.get("repeat_window_sec", 45) or 45),
|
||||
repeat_threshold=int(self.spam_config.get("repeat_threshold", 3) or 3),
|
||||
min_length=int(self.spam_config.get("repeat_min_length", 4) or 4),
|
||||
):
|
||||
self._log_event(
|
||||
"skip",
|
||||
room_id=room_id,
|
||||
sender=sender,
|
||||
reason="repeated_room_content",
|
||||
trigger_type="spam_guard",
|
||||
reply_mode="guard",
|
||||
topic="-",
|
||||
)
|
||||
return False, "repeated_room_content"
|
||||
coding_work_request = is_coding_work_request(content)
|
||||
if coding_work_request and not is_at:
|
||||
return False, "skip_coding_work"
|
||||
|
||||
Reference in New Issue
Block a user