mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
refactor(sandbox): remove unused SANDBOX_WORK_DIR constant and update bash command descriptions for clarity
This commit is contained in:
@ -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",
|
||||
|
||||
@ -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.",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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):
|
||||
|
||||
Reference in New Issue
Block a user