确保相关参数能正确传入

pull/937/head
Plutor-05 2025-05-09 09:16:20 +08:00
parent 407671ecfa
commit c7f40d7a03
3 changed files with 21 additions and 21 deletions

View File

@ -275,11 +275,11 @@ class BotConfig:
enable_pfc_chatting: bool = False # 是否启用PFC聊天
enable_pfc_reply_checker: bool = True # 是否开启PFC回复检查
# idle_conversation
enable_idle_conversation: bool = False # 是否启用 pfc 主动发言
# idle_chat
enable_idle_chat: bool = False # 是否启用 pfc 主动发言
idle_check_interval: int = 10 # 检查间隔10分钟检查一次
min_idle_time: int = 7200 # 最短无活动时间2小时 (7200秒)
max_idle_time: int = 18000 # 最长无活动时间5小时 (18000秒)
min_cooldown: int = 7200 # 最短冷却时间2小时 (7200秒)
max_cooldown: int = 18000 # 最长冷却时间5小时 (18000秒)
# 模型配置
llm_reasoning: dict[str, str] = field(default_factory=lambda: {})
@ -671,17 +671,17 @@ class BotConfig:
)
logger.info(f"PFC Reply Checker 状态: {'启用' if config.enable_pfc_reply_checker else '关闭'}")
def idle_conversation(parent: dict):
idle_conversation_config = parent["idle_conversation"]
def idle_chat(parent: dict):
idle_chat_config = parent["idle_chat"]
if config.INNER_VERSION in SpecifierSet(">=1.6.2"):
config.enable_idle_conversation = idle_conversation_config.get(
"enable_idle_conversation", config.enable_idle_conversation
config.enable_idle_chat = idle_chat_config.get(
"enable_idle_chat", config.enable_idle_chat
)
config.idle_check_interval = idle_conversation_config.get(
config.idle_check_interval = idle_chat_config.get(
"idle_check_interval", config.idle_check_interval
)
config.min_idle_time = idle_conversation_config.get("min_idle_time", config.min_idle_time)
config.max_idle_time = idle_conversation_config.get("max_idle_time", config.max_idle_time)
config.min_cooldown = idle_chat_config.get("min_cooldown", config.min_cooldown)
config.max_cooldown = idle_chat_config.get("max_cooldown", config.max_cooldown)
# 版本表达式:>=1.0.0,<2.0.0
# 允许字段func: method, support: str, notice: str, necessary: bool
@ -716,7 +716,7 @@ class BotConfig:
"chat": {"func": chat, "support": ">=1.6.0", "necessary": False},
"normal_chat": {"func": normal_chat, "support": ">=1.6.0", "necessary": False},
"focus_chat": {"func": focus_chat, "support": ">=1.6.0", "necessary": False},
"idle_conversation": {"func": idle_conversation, "support": ">=1.6.2", "necessary": False},
"idle_chat": {"func": idle_chat, "support": ">=1.6.2", "necessary": False},
}
# 原地修改,将 字符串版本表达式 转换成 版本对象

View File

@ -144,8 +144,8 @@ class IdleChat:
self._task: Optional[asyncio.Task] = None
# 配置参数 - 从global_config加载
self.min_cooldown = global_config.min_idle_time # 最短冷却时间默认2小时
self.max_cooldown = global_config.max_idle_time # 最长冷却时间默认5小时
self.min_cooldown = global_config.min_cooldown # 最短冷却时间默认2小时
self.max_cooldown = global_config.max_cooldown # 最长冷却时间默认5小时
self.check_interval = global_config.idle_check_interval * 60 # 检查间隔默认10分钟转换为秒
self.active_hours_start = 7 # 活动开始时间
self.active_hours_end = 23 # 活动结束时间
@ -157,8 +157,8 @@ class IdleChat:
def start(self) -> None:
"""启动主动聊天检测"""
# 检查是否启用了主动聊天功能
if not global_config.enable_idle_conversation:
logger.info(f"[私聊][{self.private_name}]主动聊天功能已禁用配置ENABLE_IDLE_CONVERSATION=False")
if not global_config.enable_idle_chat:
logger.info(f"[私聊][{self.private_name}]主动聊天功能已禁用配置ENABLE_IDLE_CHAT=False")
return
if self._running:
@ -350,7 +350,7 @@ class IdleChat:
try:
while self._running:
# 检查是否启用了主动聊天功能
if not global_config.enable_idle_conversation:
if not global_config.enable_idle_chat:
# 如果禁用了功能,等待一段时间后再次检查配置
await asyncio.sleep(60) # 每分钟检查一次配置变更
continue

View File

@ -190,11 +190,11 @@ talk_allowed_private = [] # 可以回复消息的QQ号
pfc_chatting = false # 是否启用PFC聊天该功能仅作用于私聊与回复模式独立
enable_pfc_reply_checker = true # 是否启用 PFC 的回复检查器
[idle_conversation]
enable_idle_conversation = false # 是否启用 pfc 主动发言
[idle_chat]
enable_idle_chat = false # 是否启用 pfc 主动发言
idle_check_interval = 10 # 检查间隔10分钟检查一次
min_idle_time = 7200 # 最短无活动时间2小时 (7200秒)
max_idle_time = 18000 # 最长无活动时间5小时 (18000秒)
min_cooldown = 7200 # 最短冷却时间2小时 (7200秒)
max_cooldown = 18000 # 最长冷却时间5小时 (18000秒)
#下面的模型若使用硅基流动则不需要更改使用ds官方则改成.env自定义的宏使用自定义模型则选择定位相似的模型自己填写
#推理模型