diff --git a/astrbot/core/astr_agent_tool_exec.py b/astrbot/core/astr_agent_tool_exec.py index 4ed600bed..43bc1b819 100644 --- a/astrbot/core/astr_agent_tool_exec.py +++ b/astrbot/core/astr_agent_tool_exec.py @@ -181,11 +181,13 @@ class FunctionToolExecutor(BaseFunctionToolExecutor[AstrAgentContext]): return # Browser tool names that require the "browser" sandbox capability. - _BROWSER_TOOL_NAMES: frozenset[str] = frozenset({ - "astrbot_execute_browser", - "astrbot_execute_browser_batch", - "astrbot_run_browser_skill", - }) + _BROWSER_TOOL_NAMES: frozenset[str] = frozenset( + { + "astrbot_execute_browser", + "astrbot_execute_browser_batch", + "astrbot_run_browser_skill", + } + ) @classmethod def _check_sandbox_capability( @@ -215,7 +217,9 @@ class FunctionToolExecutor(BaseFunctionToolExecutor[AstrAgentContext]): "Please ask the administrator to switch to a sandbox profile with " "browser support, or use shell/python tools instead." ) - logger.warning("[ToolExec] capability_rejected tool=%s caps=%s", tool.name, list(caps)) + logger.warning( + "[ToolExec] capability_rejected tool=%s caps=%s", tool.name, list(caps) + ) return mcp.types.CallToolResult( content=[mcp.types.TextContent(type="text", text=msg)], isError=True, diff --git a/astrbot/core/astr_main_agent.py b/astrbot/core/astr_main_agent.py index a65e6109f..ffc8623e6 100644 --- a/astrbot/core/astr_main_agent.py +++ b/astrbot/core/astr_main_agent.py @@ -799,7 +799,6 @@ def _apply_llm_safety_mode(config: MainAgentBuildConfig, req: ProviderRequest) - # See astrbot.core.computer.computer_tool_provider for details. - def _get_compress_provider( config: MainAgentBuildConfig, plugin_context: Context ) -> Provider | None: diff --git a/astrbot/core/computer/computer_client.py b/astrbot/core/computer/computer_client.py index 48c957574..b0a94f2f4 100644 --- a/astrbot/core/computer/computer_client.py +++ b/astrbot/core/computer/computer_client.py @@ -290,7 +290,6 @@ print( return _build_python_exec_command(script) - def _shell_exec_succeeded(result: dict) -> bool: if "success" in result: return bool(result.get("success")) diff --git a/astrbot/core/cron/manager.py b/astrbot/core/cron/manager.py index 843cc339b..afa0d2884 100644 --- a/astrbot/core/cron/manager.py +++ b/astrbot/core/cron/manager.py @@ -327,10 +327,7 @@ class CronJobManager: context_dump = req._print_friendly_context() req.contexts = [] req.system_prompt += ( - CONVERSATION_HISTORY_INJECT_PREFIX - + f"---\n" - f"{context_dump}\n" - f"---\n" + CONVERSATION_HISTORY_INJECT_PREFIX + f"---\n{context_dump}\n---\n" ) cron_job_str = json.dumps(extras.get("cron_job", {}), ensure_ascii=False) req.system_prompt += PROACTIVE_AGENT_CRON_WOKE_SYSTEM_PROMPT.format( diff --git a/astrbot/core/tools/send_message.py b/astrbot/core/tools/send_message.py index a1e7c589a..333849aa4 100644 --- a/astrbot/core/tools/send_message.py +++ b/astrbot/core/tools/send_message.py @@ -91,7 +91,9 @@ class SendMessageToUserTool(FunctionTool[AstrAgentContext]): # Use shell to check if the file exists in sandbox import shlex - result = await sb.shell.exec(f"test -f {shlex.quote(path)} && echo '_&exists_'") + result = await sb.shell.exec( + f"test -f {shlex.quote(path)} && echo '_&exists_'" + ) if "_&exists_" in json.dumps(result): # Download the file from sandbox name = os.path.basename(path)