diff --git a/src/chat/focus_chat/planners/modify_actions.py b/src/chat/focus_chat/planners/modify_actions.py index 633e8587a..1648e6cfb 100644 --- a/src/chat/focus_chat/planners/modify_actions.py +++ b/src/chat/focus_chat/planners/modify_actions.py @@ -133,7 +133,7 @@ class ActionModifier: reply_sequence.append(action_type == "reply") # 检查no_reply比例 - print(f"no_reply_count: {no_reply_count}, len(recent_cycles): {len(recent_cycles)}") + # print(f"no_reply_count: {no_reply_count}, len(recent_cycles): {len(recent_cycles)}") # print(1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111) if len(recent_cycles) >= (5 * global_config.chat.exit_focus_threshold) and ( no_reply_count / len(recent_cycles) @@ -143,11 +143,24 @@ class ActionModifier: result["remove"].append("no_reply") result["remove"].append("reply") - # 获取最近max_reply_num次的reply状态 - max_reply_num = int(global_config.focus_chat.consecutive_replies * 3) + # 计算连续回复的相关阈值 + + max_reply_num = int(global_config.focus_chat.consecutive_replies * 3.2) sec_thres_reply_num = int(global_config.focus_chat.consecutive_replies * 2) - one_thres_reply_num = int(global_config.focus_chat.consecutive_replies * 1) - last_max_reply_num = reply_sequence[-max_reply_num:] if len(reply_sequence) >= max_reply_num else reply_sequence + one_thres_reply_num = int(global_config.focus_chat.consecutive_replies * 1.5) + + # 获取最近max_reply_num次的reply状态 + if len(reply_sequence) >= max_reply_num: + last_max_reply_num = reply_sequence[-max_reply_num:] + else: + last_max_reply_num = reply_sequence[:] + + # 详细打印阈值和序列信息,便于调试 + logger.debug( + f"连续回复阈值: max={max_reply_num}, sec={sec_thres_reply_num}, one={one_thres_reply_num}," + f"最近reply序列: {last_max_reply_num}" + ) + # print(f"consecutive_replies: {consecutive_replies}") # 根据最近的reply情况决定是否移除reply动作 if len(last_max_reply_num) >= max_reply_num and all(last_max_reply_num): diff --git a/src/chat/memory_system/Hippocampus.py b/src/chat/memory_system/Hippocampus.py index 4ed26e5e0..e63840f11 100644 --- a/src/chat/memory_system/Hippocampus.py +++ b/src/chat/memory_system/Hippocampus.py @@ -239,7 +239,7 @@ class Hippocampus: # 不再需要 time_info 参数 prompt = ( f'这是一段文字:\n{text}\n\n我想让你基于这段文字来概括"{topic}"这个概念,帮我总结成一句自然的话,' - f"要求包含对这个概念的定义,内容,知识,可以包含时间和人物。只输出这句话就好" + f"要求包含对这个概念的定义,内容,知识,但是这些信息必须来自这段文字,不能添加信息。\n,请包含时间和人物。只输出这句话就好" ) return prompt diff --git a/src/config/official_configs.py b/src/config/official_configs.py index ec388c43b..af729db30 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -141,10 +141,10 @@ class FocusChatConfig(ConfigBase): compress_length_limit: int = 5 """最多压缩份数,超过该数值的压缩上下文会被删除""" - think_interval: int = 1 + think_interval: float = 1 """思考间隔(秒)""" - consecutive_replies: int = 1 + consecutive_replies: float = 1 """连续回复能力,值越高,麦麦连续回复的概率越高"""