diff --git a/src/plugins/chat/bot.py b/src/plugins/chat/bot.py index 2a81d310d..d043204e0 100644 --- a/src/plugins/chat/bot.py +++ b/src/plugins/chat/bot.py @@ -78,7 +78,7 @@ class ChatBot: timer1 = time.time() await message.process() timer2 = time.time() - logger.info(f"2消息处理时间: {timer2 - timer1}秒") + logger.debug(f"2消息处理时间: {timer2 - timer1}秒") # 过滤词/正则表达式过滤 if ( @@ -97,7 +97,7 @@ class ChatBot: message.processed_plain_text, fast_retrieval=True ) timer2 = time.time() - logger.info(f"3记忆激活时间: {timer2 - timer1}秒") + logger.debug(f"3记忆激活时间: {timer2 - timer1}秒") is_mentioned = is_mentioned_bot_in_message(message) @@ -122,7 +122,7 @@ class ChatBot: sender_id=str(message.message_info.user_info.user_id), ) timer2 = time.time() - logger.info(f"4计算意愿激活时间: {timer2 - timer1}秒") + logger.debug(f"4计算意愿激活时间: {timer2 - timer1}秒") #神秘的消息流数据结构处理 if chat.group_info: @@ -168,7 +168,7 @@ class ChatBot: timer1 = time.time() await self._handle_emoji(message, chat, response_set) timer2 = time.time() - logger.info(f"8处理表情包时间: {timer2 - timer1}秒") + logger.debug(f"8处理表情包时间: {timer2 - timer1}秒") timer1 = time.time() await self._update_using_response(message, chat, response_set) @@ -229,7 +229,7 @@ class ChatBot: container = message_manager.get_container(chat.stream_id) thinking_message = None - logger.info(f"开始发送消息准备") + # logger.info(f"开始发送消息准备") for msg in container.messages: if isinstance(msg, MessageThinking) and msg.message_info.message_id == thinking_id: thinking_message = msg @@ -240,7 +240,7 @@ class ChatBot: logger.warning("未找到对应的思考消息,可能已超时被移除") return - logger.info(f"开始发送消息") + # logger.info(f"开始发送消息") thinking_start_time = thinking_message.thinking_start_time message_set = MessageSet(chat, thinking_id) @@ -265,7 +265,7 @@ class ChatBot: if not mark_head: mark_head = True message_set.add_message(bot_message) - logger.info(f"开始添加发送消息") + # logger.info(f"开始添加发送消息") message_manager.add_message(message_set) async def _handle_emoji(self, message, chat, response): diff --git a/src/plugins/chat/llm_generator.py b/src/plugins/chat/llm_generator.py index 64bb8e915..10d73b8f1 100644 --- a/src/plugins/chat/llm_generator.py +++ b/src/plugins/chat/llm_generator.py @@ -71,8 +71,6 @@ class ResponseGenerator: return None async def _generate_response_with_model(self, message: MessageThinking, model: LLM_request): - """使用指定的模型生成回复""" - logger.info(f"开始使用生成回复-1") sender_name = "" if message.chat_stream.user_info.user_cardname and message.chat_stream.user_info.user_nickname: sender_name = ( @@ -84,7 +82,7 @@ class ResponseGenerator: else: sender_name = f"用户({message.chat_stream.user_info.user_id})" - logger.info(f"开始使用生成回复-2") + logger.debug(f"开始使用生成回复-2") # 构建prompt timer1 = time.time() prompt = await prompt_builder._build_prompt( diff --git a/src/think_flow_demo/heartflow.py b/src/think_flow_demo/heartflow.py index f3e9679e8..f8eda6237 100644 --- a/src/think_flow_demo/heartflow.py +++ b/src/think_flow_demo/heartflow.py @@ -56,7 +56,7 @@ class Heartflow: del self._subheartflows[subheartflow_id] logger.info(f"已清理不活跃的子心流: {subheartflow_id}") - await asyncio.sleep(60) # 每分钟检查一次 + await asyncio.sleep(30) # 每分钟检查一次 async def heartflow_start_working(self): # 启动清理任务 @@ -65,7 +65,7 @@ class Heartflow: while True: # 检查是否存在子心流 if not self._subheartflows: - logger.debug("当前没有子心流,等待新的子心流创建...") + logger.info("当前没有子心流,等待新的子心流创建...") await asyncio.sleep(60) # 每分钟检查一次是否有新的子心流 continue @@ -73,7 +73,7 @@ class Heartflow: await asyncio.sleep(300) # 5分钟思考一次 async def do_a_thinking(self): - logger.info("麦麦大脑袋转起来了") + logger.debug("麦麦大脑袋转起来了") self.current_state.update_current_state_info() personality_info = self.personality_info @@ -157,7 +157,7 @@ class Heartflow: asyncio.create_task(subheartflow.subheartflow_start_working()) logger.debug(f"创建异步任务 成功") self._subheartflows[subheartflow_id] = subheartflow - logger.debug(f"添加 subheartflow 成功") + logger.info(f"添加 subheartflow 成功") return self._subheartflows[subheartflow_id] def get_subheartflow(self, observe_chat_id): diff --git a/src/think_flow_demo/sub_heartflow.py b/src/think_flow_demo/sub_heartflow.py index 6611a5f54..0766077aa 100644 --- a/src/think_flow_demo/sub_heartflow.py +++ b/src/think_flow_demo/sub_heartflow.py @@ -79,7 +79,7 @@ class SubHeartflow: async def subheartflow_start_working(self): while True: current_time = time.time() - if current_time - self.last_reply_time > 180: # 3分钟 = 180秒 + if current_time - self.last_reply_time > 120: # 120秒无回复/不在场,冻结 self.is_active = False await asyncio.sleep(60) # 每60秒检查一次 else: @@ -87,7 +87,7 @@ class SubHeartflow: self.last_active_time = current_time # 更新最后激活时间 observation = self.observations[0] - observation.observe() + await observation.observe() self.current_state.update_current_state_info() @@ -96,8 +96,8 @@ class SubHeartflow: await asyncio.sleep(60) # 检查是否超过10分钟没有激活 - if current_time - self.last_active_time > 600: # 10分钟 = 600秒 - logger.info(f"子心流 {self.subheartflow_id} 已经10分钟没有激活,正在销毁...") + if current_time - self.last_active_time > 600: # 5分钟无回复/不在场,销毁 + logger.info(f"子心流 {self.subheartflow_id} 已经5分钟没有激活,正在销毁...") break # 退出循环,销毁自己 async def do_a_thinking(self): @@ -146,7 +146,7 @@ class SubHeartflow: self.update_current_mind(reponse) self.current_mind = reponse - logger.info(f"prompt:\n{prompt}\n") + logger.debug(f"prompt:\n{prompt}\n") logger.info(f"麦麦的脑内状态:{self.current_mind}") async def do_after_reply(self,reply_content,chat_talking_prompt):