Add LLM anti-prompt injection system
Introduces a comprehensive anti-prompt injection system for LLMs, including rule-based and LLM-based detection, user ban/whitelist management, message shielding, and statistics tracking. Adds new modules under src/chat/antipromptinjector, integrates anti-injection checks into the message receive flow, updates configuration and database models, and provides test scripts. Also updates templates and logger aliases to support the new system.
This commit is contained in:
@@ -160,6 +160,13 @@ class ModelTaskConfig(ConfigBase):
|
||||
))
|
||||
"""表情包识别模型配置"""
|
||||
|
||||
anti_injection: TaskConfig = field(default_factory=lambda: TaskConfig(
|
||||
model_list=["qwen2.5-vl-72b"],
|
||||
max_tokens=200,
|
||||
temperature=0.1
|
||||
))
|
||||
"""反注入检测专用模型配置"""
|
||||
|
||||
def get_task(self, task_name: str) -> TaskConfig:
|
||||
"""获取指定任务的配置"""
|
||||
if hasattr(self, task_name):
|
||||
|
||||
Reference in New Issue
Block a user