Rename command & functions to execute_shell

This commit is contained in:
Bernhard Mueller
2023-04-13 11:04:26 +07:00
parent 940772b502
commit 3ff2323450
3 changed files with 5 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ import speak
from config import Config from config import Config
import ai_functions as ai import ai_functions as ai
from file_operations import read_file, write_to_file, append_to_file, delete_file, search_files from file_operations import read_file, write_to_file, append_to_file, delete_file, search_files
from execute_code import execute_python_file, exec_shell from execute_code import execute_python_file, execute_shell
from json_parser import fix_and_parse_json from json_parser import fix_and_parse_json
from image_gen import generate_image from image_gen import generate_image
from duckduckgo_search import ddg from duckduckgo_search import ddg
@@ -103,9 +103,9 @@ def execute_command(command_name, arguments):
return ai.write_tests(arguments["code"], arguments.get("focus")) return ai.write_tests(arguments["code"], arguments.get("focus"))
elif command_name == "execute_python_file": # Add this command elif command_name == "execute_python_file": # Add this command
return execute_python_file(arguments["file"]) return execute_python_file(arguments["file"])
elif command_name == "exec_shell": elif command_name == "execute_shell":
if cfg.execute_local_commands: if cfg.execute_local_commands:
return exec_shell(arguments["command_line"]) return execute_shell(arguments["command_line"])
else: else:
return "You are not allowed to run local shell commands. To execute shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' in your config. Do not attempt to bypass the restriction." return "You are not allowed to run local shell commands. To execute shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' in your config. Do not attempt to bypass the restriction."
elif command_name == "generate_image": elif command_name == "generate_image":

View File

@@ -22,7 +22,7 @@ COMMANDS:
16. Get Improved Code: "improve_code", args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>" 16. Get Improved Code: "improve_code", args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>"
17. Write Tests: "write_tests", args: "code": "<full_code_string>", "focus": "<list_of_focus_areas>" 17. Write Tests: "write_tests", args: "code": "<full_code_string>", "focus": "<list_of_focus_areas>"
18. Execute Python File: "execute_python_file", args: "file": "<file>" 18. Execute Python File: "execute_python_file", args: "file": "<file>"
19. Execute Shell Command, non-interactive commands only: "exec_shell", args: "command_line": "<command_line>". 19. Execute Shell Command, non-interactive commands only: "execute_shell", args: "command_line": "<command_line>".
20. Task Complete (Shutdown): "task_complete", args: "reason": "<reason>" 20. Task Complete (Shutdown): "task_complete", args: "reason": "<reason>"
21. Generate Image: "generate_image", args: "prompt": "<prompt>" 21. Generate Image: "generate_image", args: "prompt": "<prompt>"
22. Do Nothing: "do_nothing", args: "" 22. Do Nothing: "do_nothing", args: ""

View File

@@ -52,7 +52,7 @@ def execute_python_file(file):
def exec_shell(command_line): def execute_shell(command_line):
old_dir = os.getcwd() old_dir = os.getcwd()