mirror of
https://github.com/langgenius/dify.git
synced 2026-03-29 09:59:59 +08:00
fix: enhance error messages for missing bash command and SSH configuration validation
This commit is contained in:
@ -91,7 +91,11 @@ class SandboxBashTool(Tool):
|
||||
) -> Generator[ToolInvokeMessage, None, None]:
|
||||
command = tool_parameters.get("bash", "")
|
||||
if not command:
|
||||
yield self.create_text_message("Error: No command provided")
|
||||
sandbox_debug("bash_tool", "parameters", tool_parameters)
|
||||
yield self.create_text_message(
|
||||
'Error: No command provided. The "bash" parameter is required and must contain '
|
||||
'the shell command to execute. Example: {"bash": "ls -la"}'
|
||||
)
|
||||
return
|
||||
|
||||
try:
|
||||
|
||||
@ -105,6 +105,8 @@ class SSHSandboxEnvironment(VirtualEnvironment):
|
||||
self._run_command(client, f"mkdir -p {shlex.quote(working_path)}")
|
||||
arch_stdout = self._run_command(client, "uname -m")
|
||||
os_stdout = self._run_command(client, "uname -s")
|
||||
except SandboxConfigValidationError as e:
|
||||
raise ValueError(f"SSH configuration validation failed, please check sandbox provider: {e}") from e
|
||||
except Exception as e:
|
||||
raise VirtualEnvironmentLaunchFailedError(f"Failed to construct SSH environment: {e}") from e
|
||||
|
||||
|
||||
Reference in New Issue
Block a user