From 287a76b03c36e3cd8458c7dc6e414fd71b8259fc Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Sun, 9 Apr 2023 10:04:03 +0100 Subject: [PATCH 1/8] add basic logging --- scripts/main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/main.py b/scripts/main.py index 10f9d0dcaa0b..61d178d739db 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -16,7 +16,15 @@ import traceback import yaml import argparse +import logging +def configure_logging(): + logging.basicConfig(filename='log.txt', + filemode='a', + format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', + datefmt='%H:%M:%S', + level=logging.DEBUG) + return logging.getLogger('AutoGPT') def print_to_console( title, @@ -26,10 +34,12 @@ def print_to_console( min_typing_speed=0.05, max_typing_speed=0.01): global cfg + global logger if speak_text and cfg.speak_mode: speak.say_text(f"{title}. {content}") print(title_color + title + " " + Style.RESET_ALL, end="") if content: + logger.info(title + ': ' + content) if isinstance(content, list): content = " ".join(content) words = content.split() @@ -270,6 +280,7 @@ def parse_arguments(): # TODO: fill in llm values here cfg = Config() +logger = configure_logging() parse_arguments() ai_name = "" prompt = construct_prompt() From b87d126e324059db3b47863dbe8e5d852234196b Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Sun, 9 Apr 2023 10:06:30 +0100 Subject: [PATCH 2/8] update print_to_console to log to a text file Uses python logging module to output progress to a text file log.txt --- scripts/main.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/main.py b/scripts/main.py index 10f9d0dcaa0b..d9b7204c2535 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -16,7 +16,15 @@ import traceback import yaml import argparse +import logging +def configure_logging(): + logging.basicConfig(filename='log.txt', + filemode='a', + format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', + datefmt='%H:%M:%S', + level=logging.DEBUG) + return logging.getLogger('AutoGPT') def print_to_console( title, @@ -26,10 +34,12 @@ def print_to_console( min_typing_speed=0.05, max_typing_speed=0.01): global cfg + global logger if speak_text and cfg.speak_mode: speak.say_text(f"{title}. {content}") print(title_color + title + " " + Style.RESET_ALL, end="") if content: + logger.info(title + ': ' + content) if isinstance(content, list): content = " ".join(content) words = content.split() @@ -270,6 +280,7 @@ def parse_arguments(): # TODO: fill in llm values here cfg = Config() +logger = configure_logging() parse_arguments() ai_name = "" prompt = construct_prompt() @@ -355,7 +366,7 @@ def parse_arguments(): f"COMMAND = {Fore.CYAN}{command_name}{Style.RESET_ALL} ARGUMENTS = {Fore.CYAN}{arguments}{Style.RESET_ALL}") # Execute command - if command_name.lower() == "error": + if command_name.lower().startswith( "error" ): result = f"Command {command_name} threw the following error: " + arguments elif command_name == "human_feedback": result = f"Human feedback: {user_input}" @@ -381,3 +392,4 @@ def parse_arguments(): "system", "Unable to execute command")) print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") + From 9cea7c0f61ce4ec6c5b7b087678f55012c249f45 Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Mon, 10 Apr 2023 08:11:54 +0100 Subject: [PATCH 3/8] Update main.py --- scripts/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/main.py b/scripts/main.py index 6ec026d323da..2f134e0cc8cd 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -395,5 +395,5 @@ def parse_arguments(): chat.create_chat_message( "system", "Unable to execute command")) print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") - - + + From 2fb06a3db5051808d5529f48ba074f62c1323c8f Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Mon, 10 Apr 2023 08:14:48 +0100 Subject: [PATCH 4/8] trying to get the right amount of spacing / newlines at the end of main.py! --- scripts/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/main.py b/scripts/main.py index 2f134e0cc8cd..1bb708c42974 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -395,5 +395,3 @@ def parse_arguments(): chat.create_chat_message( "system", "Unable to execute command")) print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") - - From a5b48790fc8266de45f52c393799f9100c418909 Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Mon, 10 Apr 2023 19:37:32 +0100 Subject: [PATCH 5/8] Delete ai_settings.yaml --- ai_settings.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 ai_settings.yaml diff --git a/ai_settings.yaml b/ai_settings.yaml deleted file mode 100644 index 1271a6e211df..000000000000 --- a/ai_settings.yaml +++ /dev/null @@ -1,6 +0,0 @@ -ai_goals: -- Increase net worth -- Grow Twitter Account -- Develop and manage multiple businesses autonomously -ai_name: Test -ai_role: Test1 From 818920e22faa82cc91821102caef5312e0ea985e Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Mon, 10 Apr 2023 19:48:42 +0100 Subject: [PATCH 6/8] restore default ai_settings --- ai_settings.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 ai_settings.yaml diff --git a/ai_settings.yaml b/ai_settings.yaml new file mode 100644 index 000000000000..b37ba849f916 --- /dev/null +++ b/ai_settings.yaml @@ -0,0 +1,7 @@ +ai_goals: +- Increase net worth. +- Develop and manage multiple businesses autonomously. +- Play to your strengths as a Large Language Model. +ai_name: Entrepreneur-GPT +ai_role: an AI designed to autonomously develop and run businesses with the sole goal + of increasing your net worth. From c6bdb0f0baf14d84b349330d24d692470e0ff35d Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Mon, 10 Apr 2023 19:50:13 +0100 Subject: [PATCH 7/8] remove trailing newline --- scripts/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/main.py b/scripts/main.py index 469a71c180d5..0ba652939c26 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -415,4 +415,4 @@ def parse_arguments(): full_message_history.append( chat.create_chat_message( "system", "Unable to execute command")) - print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") + print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") \ No newline at end of file From f69e46208e213090cbbf6c329e67466575975d62 Mon Sep 17 00:00:00 2001 From: Richard Beales Date: Mon, 10 Apr 2023 19:50:56 +0100 Subject: [PATCH 8/8] remove trailing newline --- scripts/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/main.py b/scripts/main.py index 0ba652939c26..ca75eb240da4 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -415,4 +415,5 @@ def parse_arguments(): full_message_history.append( chat.create_chat_message( "system", "Unable to execute command")) - print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") \ No newline at end of file + print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") +