From 8c51fe8373aa6ec85b8b9c9a0b5c3b45d9d35ff6 Mon Sep 17 00:00:00 2001 From: Eesa Hamza Date: Wed, 12 Apr 2023 23:38:53 +0300 Subject: [PATCH] Added new logging function as an error or warning message --- scripts/logger.py | 5 +++++ scripts/memory/pinecone.py | 6 ++---- scripts/memory/redismem.py | 6 ++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/logger.py b/scripts/logger.py index a609e602..efc2adba 100644 --- a/scripts/logger.py +++ b/scripts/logger.py @@ -123,7 +123,12 @@ class Logger(metaclass=Singleton): def set_level(self, level): self.logger.setLevel(level) self.typing_logger.setLevel(level) + + def double_check(self, additionalText=None): + if not additionalText: + additionalText = "Please ensure you've setup and configured everything correctly. Read https://github.com/Torantulino/Auto-GPT#readme to double check. You can also create a github issue or join the discord and ask there!" + self.typewriter_log("DOUBLE CHECK CONFIGURATION", Fore.YELLOW, additionalText) ''' Output stream to console using simulated typing diff --git a/scripts/memory/pinecone.py b/scripts/memory/pinecone.py index eeafd9c9..9d033f5a 100644 --- a/scripts/memory/pinecone.py +++ b/scripts/memory/pinecone.py @@ -23,10 +23,8 @@ class PineconeMemory(MemoryProviderSingleton): pinecone.whoami() except Exception as e: logger.typewriter_log("FAILED TO CONNECT TO PINECONE", Fore.RED, Style.BRIGHT + str(e) + Style.RESET_ALL) - logger.typewriter_log("DOUBLE CHECK CONFIGURATION", - Fore.YELLOW, - "Please ensure you have setup and configured Pinecone properly for use. " + - f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#-pinecone-api-key-setup{Style.RESET_ALL} to ensure you've set up everything correctly.") + logger.double_check("Please ensure you have setup and configured Pinecone properly for use. " + + f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#-pinecone-api-key-setup{Style.RESET_ALL} to ensure you've set up everything correctly.") exit(1) if table_name not in pinecone.list_indexes(): diff --git a/scripts/memory/redismem.py b/scripts/memory/redismem.py index b2d5326f..6647cbca 100644 --- a/scripts/memory/redismem.py +++ b/scripts/memory/redismem.py @@ -52,10 +52,8 @@ class RedisMemory(MemoryProviderSingleton): self.redis.ping() except redis.ConnectionError as e: logger.typewriter_log("FAILED TO CONNECT TO REDIS", Fore.RED, Style.BRIGHT + str(e) + Style.RESET_ALL) - logger.typewriter_log("DOUBLE CHECK CONFIGURATION", - Fore.YELLOW, - "Please ensure you have setup and configured Redis properly for use. " + - f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#redis-setup{Style.RESET_ALL} to ensure you've set up everything correctly.") + logger.double_check("Please ensure you have setup and configured Redis properly for use. " + + f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#redis-setup{Style.RESET_ALL} to ensure you've set up everything correctly.") exit(1) if cfg.wipe_redis_on_start: