增加注释

This commit is contained in:
Windpicker-owo
2025-09-01 13:13:56 +08:00
parent 6e50eb5929
commit d49ad0ad01

View File

@@ -66,6 +66,7 @@ class CycleProcessor:
loop_start_time = time.time()
# 第一步:动作修改
with Timer("动作修改", cycle_timers):
try:
await self.action_modifier.modify_actions()
@@ -82,6 +83,7 @@ class CycleProcessor:
if self.context.loop_mode == ChatMode.FOCUS and at_bot_mentioned and "no_reply" in available_actions:
available_actions = {k: v for k, v in available_actions.items() if k != "no_reply"}
# 检查是否在normal模式下没有可用动作除了reply相关动作
skip_planner = False
if self.context.loop_mode == ChatMode.NORMAL:
non_reply_actions = {
@@ -89,11 +91,13 @@ class CycleProcessor:
}
if not non_reply_actions:
skip_planner = True
logger.info(f"{self.log_prefix} Normal模式下没有可用动作直接回复")
plan_result = self._get_direct_reply_plan(loop_start_time)
target_message = message_data
gen_task = None
if not skip_planner and self.context.loop_mode == ChatMode.NORMAL:
# 如果normal模式且不跳过规划器开始一个回复生成进程先准备好回复其实是和planer同时进行的
if not skip_planner:
reply_to_str = await self._build_reply_to_str(message_data)
gen_task = asyncio.create_task(
self.response_handler.generate_response(
@@ -104,9 +108,8 @@ class CycleProcessor:
)
)
# Focus模式
if not skip_planner:
plan_result, target_message = await self.action_planner.plan(mode=self.context.loop_mode)
from src.plugin_system.core.event_manager import event_manager
from src.plugin_system.base.component_types import EventType
@@ -117,6 +120,9 @@ class CycleProcessor:
if result and not result.all_continue_process():
return
with Timer("规划器", cycle_timers):
plan_result, target_message = await self.action_planner.plan(mode=self.context.loop_mode)
action_result = plan_result.get("action_result", {}) if isinstance(plan_result, dict) else {}
if not isinstance(action_result, dict):
action_result = {}