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.
Refactor get_command function in app.py to accept JSON directly
Merwane Hamadi70100af98e07
diff --git a/autogpt/app.py b/autogpt/app.pyindex 6ead0d52e8..78b5bd2fde 100644--- a/autogpt/app.py+++ b/autogpt/app.py@@ -1,6 +1,6 @@""" Command and Control """import json-from typing import List, NoReturn, Union+from typing import List, NoReturn, Union, Dictfrom autogpt.agent.agent_manager import AgentManagerfrom autogpt.commands.evaluate_code import evaluate_codefrom autogpt.commands.google_search import google_official_search, google_search@@ -47,11 +47,11 @@ def is_valid_int(value: str) -> bool:return False-def get_command(response: str):+def get_command(response_json: Dict):"""Parse the response and return the command name and argumentsArgs:- response (str): The response from the user+ response_json (json): The response from the AIReturns:tuple: The command name and arguments@@ -62,8 +62,6 @@ def get_command(response: str):Exception: If any other error occurs"""try:- response_json = fix_and_parse_json(response)-if "command" not in response_json:return "Error:", "Missing 'command' object in JSON"