diff --git a/astrbot/core/agent/runners/tool_loop_agent_runner.py b/astrbot/core/agent/runners/tool_loop_agent_runner.py index 8c91adbbfd..54b389ed07 100644 --- a/astrbot/core/agent/runners/tool_loop_agent_runner.py +++ b/astrbot/core/agent/runners/tool_loop_agent_runner.py @@ -936,6 +936,10 @@ async def step(self): logger.warning( "skills_like tool re-query returned no tool calls; fallback to assistant response." ) + # Complete the assistant response (including hooks) BEFORE + # yielding llm_result so response hooks run before the + # result is sent to the user (#9788). + await self._complete_with_assistant_response(llm_resp) if llm_resp.reasoning_content: yield AgentResponse( type="llm_result", @@ -958,7 +962,6 @@ async def step(self): ), ) - await self._complete_with_assistant_response(llm_resp) return else: llm_resp.tools_call_name = requery_resp.tools_call_name diff --git a/astrbot/core/astr_main_agent.py b/astrbot/core/astr_main_agent.py index e168bbf400..e08d502d5b 100644 --- a/astrbot/core/astr_main_agent.py +++ b/astrbot/core/astr_main_agent.py @@ -1057,9 +1057,7 @@ async def _decorate_llm_request( skip_quote_image_caption=quote_images_already_captioned, ) - tz = config.timezone - if tz is None: - tz = plugin_context.get_config().get("timezone") + tz = plugin_context.get_config().get("timezone") _append_system_reminders(event, req, cfg, tz) await _apply_workspace_extra_prompt(event, req, plugin_context)