Skip to content

Commit 95948d9

Browse files
no-teasytraeagent
andcommitted
feat: 修复PR CI报错
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
1 parent feaccd7 commit 95948d9

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

astrbot/core/computer/booters/local.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import shutil
77
import subprocess
88
import sys
9+
from collections.abc import Callable
910
from dataclasses import dataclass
10-
from typing import Any, Callable
11+
from typing import Any
1112

1213
from astrbot.api import logger
1314
from astrbot.core.utils.astrbot_path import (
@@ -53,7 +54,9 @@ def _ensure_safe_path(path: str) -> str:
5354
return abs_path
5455

5556

56-
def _resolve_working_dir(configured_path: str | None, fallback_func: Callable[[], str]) -> tuple[str, bool]:
57+
def _resolve_working_dir(
58+
configured_path: str | None, fallback_func: Callable[[], str]
59+
) -> tuple[str, bool]:
5760
"""Resolve working directory with fallback to default.
5861
5962
Args:

astrbot/core/computer/tools/python.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from astrbot.core.agent.tool import ToolExecResult
99
from astrbot.core.astr_agent_context import AstrAgentContext, AstrMessageEvent
1010
from astrbot.core.computer.computer_client import get_booter, get_local_booter
11-
from astrbot.core.computer.tools.permissions import check_admin_permission, get_configured_cwd
11+
from astrbot.core.computer.tools.permissions import (
12+
check_admin_permission,
13+
get_configured_cwd,
14+
)
1215
from astrbot.core.message.message_event_result import MessageChain
1316

1417
_OS_NAME = platform.system()

astrbot/core/computer/tools/shell.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class ExecuteShellTool(FunctionTool):
4040

4141
is_local: bool = False
4242

43-
def _get_configured_cwd(self, context: ContextWrapper[AstrAgentContext]) -> str | None:
43+
def _get_configured_cwd(
44+
self, context: ContextWrapper[AstrAgentContext]
45+
) -> str | None:
4446
return get_configured_cwd(context, "computer_use_local_shell_cwd")
4547

4648
async def call(
@@ -62,7 +64,9 @@ async def call(
6264
)
6365
try:
6466
cwd = self._get_configured_cwd(context)
65-
result = await sb.shell.exec(command, cwd=cwd, background=background, env=env)
67+
result = await sb.shell.exec(
68+
command, cwd=cwd, background=background, env=env
69+
)
6670
return json.dumps(result)
6771
except Exception as e:
6872
return f"Error executing command: {str(e)}"

0 commit comments

Comments
 (0)