Refactor anti-injection system and remove command skip list

Removed the command skip list feature and related code from the anti-injection system, including configuration options, plugin command collection, and management commands. Refactored anti-injector logic to operate directly on message dictionaries and simplified whitelist and message content extraction. Updated response handling to perform anti-injection checks before reply generation, and removed skip list refresh logic from the plugin manager.
This commit is contained in:
雅诺狐
2025-08-22 15:48:21 +08:00
parent 08755ae7d1
commit 8d8d9fbda1
10 changed files with 301 additions and 486 deletions

View File

@@ -655,10 +655,6 @@ class AntiPromptInjectionConfig(ValidatedConfigBase):
auto_ban_duration_hours: int = Field(default=2, description="自动禁用持续时间(小时)")
shield_prefix: str = Field(default="🛡️ ", description="保护前缀")
shield_suffix: str = Field(default=" 🛡️", description="保护后缀")
enable_command_skip_list: bool = Field(default=True, description="启用命令跳过列表")
auto_collect_plugin_commands: bool = Field(default=True, description="启用自动收集插件命令")
manual_skip_patterns: list[str] = Field(default_factory=list, description="手动跳过模式")
skip_system_commands: bool = Field(default=True, description="启用跳过系统命令")