This commit is contained in:
tt-P607
2025-09-14 16:44:44 +08:00
12 changed files with 362 additions and 143 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)
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,15 +42,18 @@ class PlanFilter:
"""
执行筛选逻辑,并填充 Plan 对象的 decided_actions 字段。
"""
logger.debug(f"墨墨在这里加了日志 -> filter 入口 plan: {plan}")
try:
prompt, used_message_id_list = await self._build_prompt(plan)
plan.llm_prompt = prompt
logger.debug(f"墨墨在这里加了日志 -> LLM prompt: {prompt}")
llm_content, _ = await self.planner_llm.generate_response_async(prompt=prompt)
if llm_content:
logger.debug(f"LLM a原始返回: {llm_content}")
logger.debug(f"墨墨在这里加了日志 -> LLM a原始返回: {llm_content}")
parsed_json = orjson.loads(repair_json(llm_content))
logger.debug(f"墨墨在这里加了日志 -> 解析后的 JSON: {parsed_json}")
if isinstance(parsed_json, dict):
parsed_json = [parsed_json]
@@ -91,7 +94,8 @@ class PlanFilter:
plan.decided_actions = [
ActionPlannerInfo(action_type="no_action", reasoning=f"筛选时出错: {e}")
]
logger.debug(f"墨墨在这里加了日志 -> filter 出口 decided_actions: {plan.decided_actions}")
return plan
async def _build_prompt(self, plan: Plan) -> tuple[str, list]: