diff --git a/src/chat/focus_chat/heartFC_chat.py b/src/chat/focus_chat/heartFC_chat.py index 6e8beebe7..936059d1f 100644 --- a/src/chat/focus_chat/heartFC_chat.py +++ b/src/chat/focus_chat/heartFC_chat.py @@ -292,7 +292,7 @@ class HeartFChatting: async with global_prompt_manager.async_message_scope(self.chat_stream.context.get_template_name()): logger.debug(f"模板 {self.chat_stream.context.get_template_name()}") loop_info = await self._observe_process_plan_action_loop(cycle_timers, thinking_id) - + print(loop_info["loop_action_info"]["command"]) if loop_info["loop_action_info"]["command"] == "stop_focus_chat": logger.info(f"{self.log_prefix} 麦麦决定停止专注聊天") @@ -441,7 +441,7 @@ class HeartFChatting: observations.append(self.working_observation) observations.append(self.hfcloop_observation) observations.append(self.structure_observation) - + loop_observation_info = { "observations": observations, } @@ -562,10 +562,12 @@ class HeartFChatting: result = await action_handler.handle_action() if len(result) == 3: success, reply_text, command = result - else: + else: success, reply_text = result command = "" - logger.info(f"{self.log_prefix} 麦麦决定'{action}', 原因'{reasoning}',返回结果'{success}', '{reply_text}', '{command}'") + logger.info( + f"{self.log_prefix} 麦麦决定'{action}', 原因'{reasoning}',返回结果'{success}', '{reply_text}', '{command}'" + ) return success, reply_text, command except Exception as e: diff --git a/src/chat/focus_chat/info_processors/action_processor.py b/src/chat/focus_chat/info_processors/action_processor.py index fe2d8675b..6979a1d88 100644 --- a/src/chat/focus_chat/info_processors/action_processor.py +++ b/src/chat/focus_chat/info_processors/action_processor.py @@ -136,7 +136,9 @@ class ActionProcessor(BaseProcessor): reply_sequence.append(action_type == "reply") # 检查no_reply比例 - if len(recent_cycles) >= (5 * global_config.focus_chat.exit_focus_threshold) and (no_reply_count / len(recent_cycles)) >= (0.75 * global_config.focus_chat.exit_focus_threshold): + if len(recent_cycles) >= (5 * global_config.focus_chat.exit_focus_threshold) and ( + no_reply_count / len(recent_cycles) + ) >= (0.75 * global_config.focus_chat.exit_focus_threshold): if global_config.chat.chat_mode == "auto": result["add"].append("exit_focus_chat") result["remove"].append("no_reply") diff --git a/src/chat/focus_chat/planners/action_manager.py b/src/chat/focus_chat/planners/action_manager.py index d2ed378c2..7be944ae6 100644 --- a/src/chat/focus_chat/planners/action_manager.py +++ b/src/chat/focus_chat/planners/action_manager.py @@ -159,8 +159,8 @@ class ActionManager: """ # 检查动作是否在当前使用的动作集中 # if action_name not in self._using_actions: - # logger.warning(f"当前不可用的动作类型: {action_name}") - # return None + # logger.warning(f"当前不可用的动作类型: {action_name}") + # return None handler_class = _ACTION_REGISTRY.get(action_name) if not handler_class: diff --git a/src/chat/heart_flow/interest_chatting.py b/src/chat/heart_flow/interest_chatting.py index 4cb477c04..8e493179f 100644 --- a/src/chat/heart_flow/interest_chatting.py +++ b/src/chat/heart_flow/interest_chatting.py @@ -1,5 +1,4 @@ import asyncio -from src.config.config import global_config from typing import Optional, Dict import traceback from src.common.logger_manager import get_logger diff --git a/src/chat/heart_flow/sub_heartflow.py b/src/chat/heart_flow/sub_heartflow.py index a7e980f43..eb5affb33 100644 --- a/src/chat/heart_flow/sub_heartflow.py +++ b/src/chat/heart_flow/sub_heartflow.py @@ -332,7 +332,7 @@ class SubHeartflow: if self.normal_chat_instance: return self.normal_chat_instance.get_recent_replies(limit) return [] - + def add_interest_message(self, message: MessageRecv, interest_value: float, is_mentioned: bool): self.interest_dict[message.message_info.message_id] = (message, interest_value, is_mentioned) # 如果字典长度超过10,删除最旧的消息 @@ -361,7 +361,6 @@ class SubHeartflow: await self._stop_normal_chat() await self._stop_heart_fc_chat() - # 取消可能存在的旧后台任务 (self.task) if self.task and not self.task.done(): logger.debug(f"{self.log_prefix} 取消子心流主任务 (Shutdown)...")