chore(log): 移除调试日志并将部分日志级别降为debug

将规划器和过滤器中的临时调试日志移除,并将部分用于追踪流程的info级别日志调整为debug级别,以减少在生产环境中的日志噪音。

同时,在`cycle_processor.py`中增加了对事件处理结果的空值检查,以增强代码的健壮性。(也许是bug真的能修好了——)
This commit is contained in:
minecraft1024a
2025-09-14 14:59:32 +08:00
committed by Windpicker-owo
parent dc5ee7b150
commit cbbb5746ce
2 changed files with 13 additions and 10 deletions

View File

@@ -201,11 +201,11 @@ class CycleProcessor:
result = await event_manager.trigger_event(
EventType.ON_PLAN, permission_group="SYSTEM", stream_id=self.context.chat_stream
)
if not result.all_continue_process():
if result and not result.all_continue_process():
raise UserWarning(f"插件{result.get_summary().get('stopped_handlers', '')}于规划前中断了内容生成")
with Timer("规划器", cycle_timers):
actions, _ = await self.action_planner.plan(mode=mode)
logger.info(f"如果你探到这条日志请把它复制下来发到Q群里,如果你探到这条日志请把它复制下来发到Q群里,如果你探到这条日志请把它复制下来发到Q群里,调试内容",str(actions))
async def execute_action(action_info):
"""执行单个动作的通用函数"""
try:
@@ -298,9 +298,12 @@ class CycleProcessor:
if reply_actions:
logger.info(f"{self.log_prefix} 正在执行文本回复...")
for action in reply_actions:
target_user_id = action.get("action_message",{}).get("chat_info_user_id","")
action_message_test =action.get("action_message",{})
logger.info(f"如果你探到这条日志请把它复制下来发到Q群里,如果你探到这条日志请把它复制下来发到Q群里,如果你探到这条日志请把它复制下来发到Q群里,调试内容:{action_message_test}")
action_message = action.get("action_message")
if not action_message:
logger.warning(f"{self.log_prefix} reply 动作缺少 action_message,跳过")
continue
target_user_id = action_message.get("chat_info_user_id","")
if target_user_id == global_config.bot.qq_account and not global_config.chat.allow_reply_self:
logger.warning("选取的reply的目标为bot自己跳过reply action")
continue

View File

@@ -42,18 +42,18 @@ class PlanFilter:
"""
执行筛选逻辑,并填充 Plan 对象的 decided_actions 字段。
"""
logger.info(f"墨墨在这里加了日志 -> filter 入口 plan: {plan}")
logger.debug(f"墨墨在这里加了日志 -> filter 入口 plan: {plan}")
try:
prompt, used_message_id_list = await self._build_prompt(plan)
plan.llm_prompt = prompt
logger.info(f"墨墨在这里加了日志 -> LLM prompt: {prompt}")
logger.debug(f"墨墨在这里加了日志 -> LLM prompt: {prompt}")
llm_content, _ = await self.planner_llm.generate_response_async(prompt=prompt)
if llm_content:
logger.warning(f"墨墨在这里加了日志 -> LLM a原始返回: {llm_content}")
logger.debug(f"墨墨在这里加了日志 -> LLM a原始返回: {llm_content}")
parsed_json = orjson.loads(repair_json(llm_content))
logger.info(f"墨墨在这里加了日志 -> 解析后的 JSON: {parsed_json}")
logger.debug(f"墨墨在这里加了日志 -> 解析后的 JSON: {parsed_json}")
if isinstance(parsed_json, dict):
parsed_json = [parsed_json]
@@ -95,7 +95,7 @@ class PlanFilter:
ActionPlannerInfo(action_type="no_action", reasoning=f"筛选时出错: {e}")
]
logger.info(f"墨墨在这里加了日志 -> filter 出口 decided_actions: {plan.decided_actions}")
logger.debug(f"墨墨在这里加了日志 -> filter 出口 decided_actions: {plan.decided_actions}")
return plan
async def _build_prompt(self, plan: Plan) -> tuple[str, list]: