mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Introduce EXECUTE_SHELL_COMMANDS config var, default to False
This commit is contained in:
@@ -7,6 +7,7 @@ FAST_LLM_MODEL="gpt-3.5-turbo"
|
||||
GOOGLE_API_KEY=
|
||||
CUSTOM_SEARCH_ENGINE_ID=
|
||||
USE_AZURE=False
|
||||
EXECUTE_LOCAL_COMMANDS=False
|
||||
OPENAI_API_BASE=your-base-url-for-azure
|
||||
OPENAI_API_VERSION=api-version-for-azure
|
||||
OPENAI_DEPLOYMENT_ID=deployment-id-for-azure
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -104,8 +104,11 @@ def execute_command(command_name, arguments):
|
||||
return ai.write_tests(arguments["code"], arguments.get("focus"))
|
||||
elif command_name == "execute_python_file": # Add this command
|
||||
return execute_python_file(arguments["file"])
|
||||
elif command_name == "exec_shell": # Add this command
|
||||
return exec_shell(arguments["command_line"])
|
||||
elif command_name == "exec_shell":
|
||||
if cfg.execute_local_commands:
|
||||
return exec_shell(arguments["command_line"])
|
||||
else:
|
||||
return "You are not allowed to run local shell commands. To execute shell commands, EXECUTE_SHELL_COMMANDS must be set to 'True' in your config. Do not attempt to bypass the restriction."
|
||||
elif command_name == "generate_image":
|
||||
return generate_image(arguments["prompt"])
|
||||
elif command_name == "task_complete":
|
||||
|
||||
@@ -43,6 +43,8 @@ class Config(metaclass=Singleton):
|
||||
self.openai_api_key = os.getenv("OPENAI_API_KEY")
|
||||
self.use_azure = False
|
||||
self.use_azure = os.getenv("USE_AZURE") == 'True'
|
||||
self.execute_local_commands = os.getenv('EXECUTE_LOCAL_COMMANDS', 'False') == 'True'
|
||||
|
||||
if self.use_azure:
|
||||
self.openai_api_base = os.getenv("OPENAI_API_BASE")
|
||||
self.openai_api_version = os.getenv("OPENAI_API_VERSION")
|
||||
|
||||
Reference in New Issue
Block a user