diff --git a/AutonomousAI/commands.py b/AutonomousAI/commands.py index ef1c6ded..fbf11029 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.txt index 711b2178..6236a30d 100644 --- a/AutonomousAI/data/prompt.txt +++ b/AutonomousAI/data/prompt.txt @@ -17,6 +17,7 @@ COMMANDS: 10. Delete GPT Agent: "delete_agent", args: "key": "" 9. Navigate & Perform: "navigate_website", args: "action": "click_button/input_text/register_account", "text/username": "/" 11. Get Text Summary: "get_text_summary", args: "url": "" +13. Write to file: "write_to_file", args: "file": "", "text": "" RESOURCES: