AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Adds write_to_file command.
Torantulinoacbf0dc7018d
diff --git a/AutonomousAI/commands.py b/AutonomousAI/commands.pyindex ef1c6ded50..fbf11029f3 100644--- a/AutonomousAI/commands.py+++ b/AutonomousAI/commands.py@@ -50,6 +50,8 @@ def execute_command(command_name, arguments):return register_account(arguments["username"], arguments["website"])elif command_name == "get_text_summary":return get_text_summary(arguments["url"])+ elif command_name == "write_to_file":+ return write_to_file(arguments["file"], arguments["content"])else:return f"unknown command {command_name}"# All other errors, return "Error: + error message"@@ -103,6 +105,21 @@ def overwrite_memory(key, string):else:print("Invalid key, cannot overwrite memory.")return None++def write_to_file(filename, content):+ try:+ f = open(filename, "w")+ f.write(content)+ f.close()+ except Exception as e:+ return "Error: " + str(e)+ return "File written to successfully."++def shutdown():+ print("Shutting down...")+ quit()++### TODO: Not Yet Implemented: ###diff --git a/AutonomousAI/data/prompt.txt b/AutonomousAI/data/prompt.txtindex 711b21782c..6236a30da5 100644--- a/AutonomousAI/data/prompt.txt+++ b/AutonomousAI/data/prompt.txt@@ -17,6 +17,7 @@ COMMANDS:10. Delete GPT Agent: "delete_agent", args: "key": "<key>"9. Navigate & Perform: "navigate_website", args: "action": "click_button/input_text/register_account", "text/username": "<text>/<username>"11. Get Text Summary: "get_text_summary", args: "url": "<url>"+13. Write to file: "write_to_file", args: "file": "<file>", "text": "<text>"RESOURCES: