refactor(sandbox): remove unused SANDBOX_WORK_DIR constant and update bash command descriptions for clarity

This commit is contained in:
Harry
2026-01-12 15:02:24 +08:00
parent 201a18d6ba
commit 1082d73355
9 changed files with 13 additions and 17 deletions

View File

@ -3,7 +3,6 @@ from core.sandbox.constants import (
DIFY_CLI_CONFIG_PATH,
DIFY_CLI_PATH,
DIFY_CLI_PATH_PATTERN,
SANDBOX_WORK_DIR,
)
from core.sandbox.dify_cli import (
DifyCliBinary,
@ -19,7 +18,6 @@ __all__ = [
"DIFY_CLI_CONFIG_PATH",
"DIFY_CLI_PATH",
"DIFY_CLI_PATH_PATTERN",
"SANDBOX_WORK_DIR",
"DifyCliBinary",
"DifyCliConfig",
"DifyCliEnvConfig",

View File

@ -33,18 +33,18 @@ class SandboxBashTool(Tool):
parameters=[
ToolParameter.get_simple_instance(
name="command",
llm_description="The bash command to execute in the sandbox environment",
llm_description="The bash command to execute in current working directory",
typ=ToolParameter.ToolParameterType.STRING,
required=True,
),
],
description=ToolDescription(
human=I18nObject(
en_US="Execute bash commands in the sandbox environment",
en_US="Execute bash commands in current working directory",
),
llm="Execute bash commands in the sandbox environment. "
llm="Execute bash commands in current working directory. "
"Use this tool to run shell commands, scripts, or interact with the system. "
"The command will be executed in an isolated sandbox environment.",
"The command will be executed in the current working directory.",
),
)

View File

@ -1,9 +1,7 @@
from typing import Final
SANDBOX_WORK_DIR: Final[str] = "work"
DIFY_CLI_PATH: Final[str] = f"{SANDBOX_WORK_DIR}/.dify/bin/dify"
DIFY_CLI_PATH: Final[str] = ".dify/bin/dify"
DIFY_CLI_PATH_PATTERN: Final[str] = "dify-cli-{os}-{arch}"
DIFY_CLI_CONFIG_PATH: Final[str] = f"{SANDBOX_WORK_DIR}/.dify_cli.json"
DIFY_CLI_CONFIG_PATH: Final[str] = ".dify_cli.json"

View File

@ -12,8 +12,7 @@ logger = logging.getLogger(__name__)
class SandboxInitializer(ABC):
@abstractmethod
def initialize(self, env: VirtualEnvironment) -> None:
...
def initialize(self, env: VirtualEnvironment) -> None: ...
class DifyCliInitializer(SandboxInitializer):