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:
@@ -1,5 +1,5 @@
|
||||
[inner]
|
||||
version = "1.2.4"
|
||||
version = "1.2.5"
|
||||
|
||||
# 配置文件版本号迭代规则同bot_config.toml
|
||||
|
||||
@@ -113,6 +113,12 @@ api_provider = "SiliconFlow"
|
||||
price_in = 0
|
||||
price_out = 0
|
||||
|
||||
[[models]]
|
||||
model_identifier = "moonshotai/Kimi-K2-Instruct"
|
||||
name = "moonshotai-Kimi-K2-Instruct"
|
||||
api_provider = "SiliconFlow"
|
||||
price_in = 4.0
|
||||
price_out = 16.0
|
||||
|
||||
[model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,是麦麦必须的模型
|
||||
model_list = ["siliconflow-deepseek-v3"] # 使用的模型列表,每个子项对应上面的模型名称(name)
|
||||
@@ -177,6 +183,11 @@ model_list = ["deepseek-v3"]
|
||||
temperature = 0.7
|
||||
max_tokens = 1000
|
||||
|
||||
[model_task_config.anti_injection] # 反注入检测专用模型
|
||||
model_list = ["moonshotai-Kimi-K2-Instruct"] # 使用快速的小模型进行检测
|
||||
temperature = 0.1 # 低温度确保检测结果稳定
|
||||
max_tokens = 200 # 检测结果不需要太长的输出
|
||||
|
||||
#嵌入模型
|
||||
[model_task_config.embedding]
|
||||
model_list = ["bge-m3"]
|
||||
|
||||
Reference in New Issue
Block a user