diff --git a/src/config/config.py b/src/config/config.py index da5b3c2e..290dbb43 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -274,6 +274,7 @@ class BotConfig: talk_allowed_private = set() enable_pfc_chatting: bool = False # 是否启用PFC聊天 enable_pfc_reply_checker: bool = True # 是否开启PFC回复检查 + pfc_message_buffer_size:int = 2 # PFC 聊天消息缓冲数量,有利于使聊天节奏更加紧凑流畅,请根据实际 LLM 响应速度进行调整,默认2条 # idle_conversation enable_idle_conversation: bool = False # 是否启用 pfc 主动发言 @@ -670,6 +671,9 @@ class BotConfig: "enable_pfc_reply_checker", config.enable_pfc_reply_checker ) logger.info(f"PFC Reply Checker 状态: {'启用' if config.enable_pfc_reply_checker else '关闭'}") + config.pfc_message_buffer_size = experimental_config.get( + "pfc_message_buffer_size", config.pfc_message_buffer_size + ) def idle_conversation(parent: dict): idle_conversation_config = parent["idle_conversation"] diff --git a/src/plugins/PFC/conversation_loop.py b/src/plugins/PFC/conversation_loop.py index 190e049a..aab031cc 100644 --- a/src/plugins/PFC/conversation_loop.py +++ b/src/plugins/PFC/conversation_loop.py @@ -275,7 +275,7 @@ async def run_conversation_loop(conversation_instance: "Conversation"): f"[私聊][{conversation_instance.private_name}] (Loop) Found {len(other_new_messages_this_check)} 'other_new_messages_this_check'." ) - if len(other_new_messages_this_check) > 2: + if len(other_new_messages_this_check) > global_config.pfc_message_buffer_size: logger.info( f"[私聊][{conversation_instance.private_name}] (Loop) LLM动作 '{action}' 执行期间收到 {len(other_new_messages_this_check)} 条来自他人的新消息,将取消LLM任务。" ) diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 55b22cad..1d79349a 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -189,6 +189,7 @@ enable_friend_chat = false # 是否启用好友聊天 talk_allowed_private = [] # 可以回复消息的QQ号 pfc_chatting = false # 是否启用PFC聊天,该功能仅作用于私聊,与回复模式独立 enable_pfc_reply_checker = true # 是否启用 PFC 的回复检查器 +pfc_message_buffer_size = 2 # PFC 聊天消息缓冲数量,有利于使聊天节奏更加紧凑流畅,请根据实际 LLM 响应速度进行调整,默认2条 [idle_conversation] enable_idle_conversation = false # 是否启用 pfc 主动发言