From dd4fdaeb95f537cd92b828efa7b1f4bbe611eb26 Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Thu, 25 Sep 2025 21:11:11 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=B7=BB=E5=8A=A0plan=E9=98=B2?= =?UTF-8?q?=E6=8A=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/heart_flow/heartFC_chat.py | 13 +++++++++++++ src/config/official_configs.py | 2 ++ template/bot_config_template.toml | 7 ++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/chat/heart_flow/heartFC_chat.py b/src/chat/heart_flow/heartFC_chat.py index b0cf9bbe..bb36b102 100644 --- a/src/chat/heart_flow/heartFC_chat.py +++ b/src/chat/heart_flow/heartFC_chat.py @@ -276,6 +276,9 @@ class HeartFChatting: recent_messages_list = [] reply_text = "" # 初始化reply_text变量,避免UnboundLocalError + + start_time = time.time() + if s4u_config.enable_s4u: await send_typing() @@ -410,8 +413,18 @@ class HeartFChatting: } reply_text = action_reply_text + end_time = time.time() + if end_time - start_time < global_config.chat.planner_smooth: + wait_time = global_config.chat.planner_smooth - (end_time - start_time) + await asyncio.sleep(wait_time) + else: + await asyncio.sleep(0.1) + + self.end_cycle(loop_info, cycle_timers) self.print_cycle_info(cycle_timers) + + """S4U内容,暂时保留""" if s4u_config.enable_s4u: diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 4c3beb95..a56f731f 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -84,6 +84,8 @@ class ChatConfig(ConfigBase): at_bot_inevitable_reply: float = 1 """@bot 必然回复,1为100%回复,0为不额外增幅""" + planner_smooth: float = 3 + """规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐2-5,0为关闭,必须大于等于0""" talk_value: float = 1 """思考频率""" diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index d9672722..5ff15daf 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.14.3" +version = "6.15.0" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -71,9 +71,10 @@ expression_groups = [ [chat] #麦麦的聊天设置 -talk_value = 1 +talk_value = 1 #聊天频率,越小越沉默,范围0-1 mentioned_bot_reply = true # 是否启用提及必回复 -max_context_size = 20 # 上下文长度 +max_context_size = 30 # 上下文长度 +planner_smooth = 5 #规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐2-8,0为关闭,必须大于等于0 [relationship] enable_relationship = true # 是否启用关系系统