添加一个最小回复概率的设置项,还未实装

pull/256/head
Pliosauroidea 2025-03-12 12:06:28 +08:00
parent 65fc4ae1b0
commit 50a98f1bfe
2 changed files with 47 additions and 13 deletions

View File

@ -37,7 +37,6 @@ class BotConfig:
ban_user_id = set() ban_user_id = set()
EMOJI_CHECK_INTERVAL: int = 120 # 表情包检查间隔(分钟) EMOJI_CHECK_INTERVAL: int = 120 # 表情包检查间隔(分钟)
EMOJI_REGISTER_INTERVAL: int = 10 # 表情包注册间隔(分钟) EMOJI_REGISTER_INTERVAL: int = 10 # 表情包注册间隔(分钟)
EMOJI_SAVE: bool = True # 偷表情包 EMOJI_SAVE: bool = True # 偷表情包
@ -76,11 +75,17 @@ class BotConfig:
keywords_reaction_rules = [] # 关键词回复规则 keywords_reaction_rules = [] # 关键词回复规则
chinese_typo_enable = True # 是否启用中文错别字生成器 chinese_typo_enable: bool = True # 是否启用中文错别字生成器
chinese_typo_error_rate = 0.03 # 单字替换概率 chinese_typo_error_rate: float = 0.03 # 单字替换概率
chinese_typo_min_freq = 7 # 最小字频阈值 chinese_typo_min_freq: float = 7 # 最小字频阈值
chinese_typo_tone_error_rate = 0.2 # 声调错误概率 chinese_typo_tone_error_rate: float = 0.2 # 声调错误概率
chinese_typo_word_replace_rate = 0.02 # 整词替换概率 chinese_typo_word_replace_rate: float = 0.02 # 整词替换概率
reply_possibility_enhance_enable: bool = True # 是否启用回复可能性增强
minumum_group_reply_possibility = 0 # 最低群组回复可能性
minumum_friend_reply_possibility = 0.5 # 最低好友回复可能性
max_group_reply_possibility = 1.0 # 最大回复可能性
max_friend_reply_possibility = 1.0 # 最大回复可能性
# 默认人设 # 默认人设
PROMPT_PERSONALITY = [ PROMPT_PERSONALITY = [
@ -302,7 +307,9 @@ class BotConfig:
if config.INNER_VERSION in SpecifierSet(">=0.0.7"): if config.INNER_VERSION in SpecifierSet(">=0.0.7"):
config.memory_forget_time = memory_config.get("memory_forget_time", config.memory_forget_time) config.memory_forget_time = memory_config.get("memory_forget_time", config.memory_forget_time)
config.memory_forget_percentage = memory_config.get("memory_forget_percentage", config.memory_forget_percentage) config.memory_forget_percentage = memory_config.get(
"memory_forget_percentage", config.memory_forget_percentage
)
config.memory_compress_rate = memory_config.get("memory_compress_rate", config.memory_compress_rate) config.memory_compress_rate = memory_config.get("memory_compress_rate", config.memory_compress_rate)
def mood(parent: dict): def mood(parent: dict):
@ -342,6 +349,24 @@ class BotConfig:
config.enable_debug_output = others_config.get("enable_debug_output", config.enable_debug_output) config.enable_debug_output = others_config.get("enable_debug_output", config.enable_debug_output)
config.enable_friend_chat = others_config.get("enable_friend_chat", config.enable_friend_chat) config.enable_friend_chat = others_config.get("enable_friend_chat", config.enable_friend_chat)
def reply_possibility_enhance(parent: dict):
reply_possibility_enhance_config = parent["reply_possibility_enhance"]
config.reply_possibility_enhance_enable = reply_possibility_enhance_config.get(
"enable", config.reply_possibility_enhance_config_enable
)
config.minumum_group_reply_possibility = reply_possibility_enhance_config.get(
"minumum_group_reply_possibility", config.minumum_group_reply_possibility
)
config.minumum_friend_reply_possibility = reply_possibility_enhance_config.get(
"minumum_friend_reply_possibility", config.minumum_friend_reply_possibility
)
config.max_group_reply_possibility = reply_possibility_enhance_config.get(
"max_group_reply_possibility", config.max_group_reply_possibility
)
config.max_friend_reply_possibility = reply_possibility_enhance_config.get(
"max_friend_reply_possibility", config.max_friend_reply_possibility
)
# 版本表达式:>=1.0.0,<2.0.0 # 版本表达式:>=1.0.0,<2.0.0
# 允许字段func: method, support: str, notice: str, necessary: bool # 允许字段func: method, support: str, notice: str, necessary: bool
# 如果使用 notice 字段,在该组配置加载时,会展示该字段对用户的警示 # 如果使用 notice 字段,在该组配置加载时,会展示该字段对用户的警示
@ -361,6 +386,7 @@ class BotConfig:
"chinese_typo": {"func": chinese_typo, "support": ">=0.0.3", "necessary": False}, "chinese_typo": {"func": chinese_typo, "support": ">=0.0.3", "necessary": False},
"groups": {"func": groups, "support": ">=0.0.0"}, "groups": {"func": groups, "support": ">=0.0.0"},
"others": {"func": others, "support": ">=0.0.0"}, "others": {"func": others, "support": ">=0.0.0"},
"reply_possibility_enhance": {"func": reply_possibility_enhance, "support": ">=0.0.9", "necessary": False},
} }
# 原地修改,将 字符串版本表达式 转换成 版本对象 # 原地修改,将 字符串版本表达式 转换成 版本对象

View File

@ -1,5 +1,5 @@
[inner] [inner]
version = "0.0.8" version = "0.0.9"
#如果你想要修改配置文件请在修改后将version的值进行变更 #如果你想要修改配置文件请在修改后将version的值进行变更
#如果新增项目请在BotConfig类下新增相应的变量 #如果新增项目请在BotConfig类下新增相应的变量
@ -108,6 +108,14 @@ enable_kuuki_read = true # 是否启用读空气功能
enable_debug_output = false # 是否启用调试输出 enable_debug_output = false # 是否启用调试输出
enable_friend_chat = false # 是否启用好友聊天 enable_friend_chat = false # 是否启用好友聊天
[reply_possibility_enhance]
enable = true # 是否启用回复可能性增强
minumum_group_reply_possibility = 0 # 最低群组回复可能性
minumum_friend_reply_possibility = 0.5 # 最低好友回复可能性
max_group_reply_possibility = 1.0 # 最大回复可能性
max_friend_reply_possibility = 1.0 # 最大回复可能性
[groups] [groups]
talk_allowed = [ talk_allowed = [
123, 123,