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.
fix assistant thoughts failure on string type
yousefissa82da7f1681a1
diff --git a/scripts/main.py b/scripts/main.pyindex 97c05d7dbd..a1c08018a4 100644--- a/scripts/main.py+++ b/scripts/main.py@@ -52,6 +52,14 @@ def print_assistant_thoughts(assistant_reply):# Parse and print Assistant responseassistant_reply_json = fix_and_parse_json(assistant_reply)+ # Check if assistant_reply_json is a string and attempt to parse it into a JSON object+ if isinstance(assistant_reply_json, str):+ try:+ assistant_reply_json = json.loads(assistant_reply_json)+ except json.JSONDecodeError as e:+ print_to_console("Error: Invalid JSON\n", Fore.RED, assistant_reply)+ assistant_reply_json = {}+assistant_thoughts_reasoning = Noneassistant_thoughts_plan = Noneassistant_thoughts_speak = None@@ -90,10 +98,6 @@ def print_assistant_thoughts(assistant_reply):except json.decoder.JSONDecodeError:print_to_console("Error: Invalid JSON\n", Fore.RED, assistant_reply)- # All other errors, return "Error: + error message"- except Exception as e:- call_stack = traceback.format_exc()- print_to_console("Error: \n", Fore.RED, call_stack)def load_variables(config_file="config.yaml"):