fix:修改Looger
This commit is contained in:
@@ -511,12 +511,12 @@ class SubHeartflow:
|
||||
|
||||
# 取消可能存在的旧后台任务 (self.task)
|
||||
if self.task and not self.task.done():
|
||||
logger.info(f"{self.log_prefix} 取消子心流主任务 (Shutdown)...")
|
||||
logger.debug(f"{self.log_prefix} 取消子心流主任务 (Shutdown)...")
|
||||
self.task.cancel()
|
||||
try:
|
||||
await asyncio.wait_for(self.task, timeout=1.0) # 给点时间响应取消
|
||||
except asyncio.CancelledError:
|
||||
logger.info(f"{self.log_prefix} 子心流主任务已取消 (Shutdown)。")
|
||||
logger.debug(f"{self.log_prefix} 子心流主任务已取消 (Shutdown)。")
|
||||
except asyncio.TimeoutError:
|
||||
logger.warning(f"{self.log_prefix} 等待子心流主任务取消超时 (Shutdown)。")
|
||||
except Exception as e:
|
||||
|
||||
@@ -1001,8 +1001,8 @@ class HeartFChatting:
|
||||
}
|
||||
anchor_message = MessageRecv(placeholder_msg_dict)
|
||||
anchor_message.update_chat_stream(self.chat_stream)
|
||||
logger.info(
|
||||
f"{self.log_prefix} Created placeholder anchor message: ID={anchor_message.message_info.message_id}"
|
||||
logger.debug(
|
||||
f"{self.log_prefix} 创建占位符锚点消息: ID={anchor_message.message_info.message_id}"
|
||||
)
|
||||
return anchor_message
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ JSON 结构如下,包含三个字段 "action", "reasoning", "emoji_query":
|
||||
{{
|
||||
"action": "string", // 必须是上面提供的可用行动之一 (例如: '{example_action}')
|
||||
"reasoning": "string", // 做出此决定的详细理由和思考过程,说明你如何应用了回复原则
|
||||
"emoji_query": "string" // 可选。如果行动是 'emoji_reply',必须提供表情主题;如果行动是 'text_reply' 且你想附带表情,也在此提供表情主题,否则留空字符串 ""。遵循回复原则,不要滥用。
|
||||
"emoji_query": "string" // 可选。如果行动是 'emoji_reply',必须提供表情主题(填写表情包的适用场合);如果行动是 'text_reply' 且你想附带表情,也在此提供表情主题,否则留空字符串 ""。遵循回复原则,不要滥用。
|
||||
}}
|
||||
|
||||
例如:
|
||||
|
||||
@@ -443,7 +443,7 @@ class NormalChat:
|
||||
logger.error(f"[{self.stream_name}] 任务异常: {exc}")
|
||||
logger.error(traceback.format_exc())
|
||||
except asyncio.CancelledError:
|
||||
logger.info(f"[{self.stream_name}] 任务已取消")
|
||||
logger.debug(f"[{self.stream_name}] 任务已取消")
|
||||
except Exception as e:
|
||||
logger.error(f"[{self.stream_name}] 回调处理错误: {e}")
|
||||
finally:
|
||||
@@ -456,12 +456,12 @@ class NormalChat:
|
||||
"""停止当前实例的兴趣监控任务。"""
|
||||
if self._chat_task and not self._chat_task.done():
|
||||
task = self._chat_task
|
||||
logger.info(f"[{self.stream_name}] 尝试取消聊天任务。")
|
||||
logger.debug(f"[{self.stream_name}] 尝试取消normal聊天任务。")
|
||||
task.cancel()
|
||||
try:
|
||||
await task # 等待任务响应取消
|
||||
except asyncio.CancelledError:
|
||||
logger.info(f"[{self.stream_name}] 聊天任务已成功取消。")
|
||||
logger.info(f"[{self.stream_name}] 结束一般聊天模式。")
|
||||
except Exception as e:
|
||||
# 回调函数 _handle_task_completion 会处理异常日志
|
||||
logger.warning(f"[{self.stream_name}] 等待监控任务取消时捕获到异常 (可能已在回调中记录): {e}")
|
||||
|
||||
@@ -82,12 +82,14 @@ class NormalChatGenerator:
|
||||
sender_name=sender_name,
|
||||
chat_stream=message.chat_stream,
|
||||
)
|
||||
logger.info(f"构建prompt时间: {t_build_prompt.human_readable}")
|
||||
logger.debug(f"构建prompt时间: {t_build_prompt.human_readable}")
|
||||
|
||||
try:
|
||||
content, reasoning_content, self.current_model_name = await model.generate_response(prompt)
|
||||
|
||||
logger.info(f"prompt:{prompt}\n生成回复:{content}")
|
||||
logger.debug(f"prompt:{prompt}\n生成回复:{content}")
|
||||
|
||||
logger.info(f"对 {message.processed_plain_text} 的回复:{content}")
|
||||
|
||||
info_catcher.catch_after_llm_generated(
|
||||
prompt=prompt, response=content, reasoning_content=reasoning_content, model_name=self.current_model_name
|
||||
|
||||
Reference in New Issue
Block a user