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.
Move misc printing functions from app.main to app.utils
Reinier van der Leer12656646ae57
diff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.pyindex 70c704ea87..3ec1c562df 100644--- a/autogpts/autogpt/autogpt/app/main.py+++ b/autogpts/autogpt/autogpt/app/main.py@@ -19,10 +19,11 @@ from autogpt.app.setup import interactive_ai_profile_setupfrom autogpt.app.spinner import Spinnerfrom autogpt.app.utils import (clean_input,- get_current_git_branch,- get_latest_bulletin,get_legal_warning,markdown_to_ansi_style,+ print_git_branch_info,+ print_motd,+ print_python_version_info,)from autogpt.commands import COMMAND_CATEGORIESfrom autogpt.config import (@@ -173,47 +174,6 @@ async def run_auto_gpt(await run_interaction_loop(agent)-def print_motd(config: Config, logger: logging.Logger):- motd, is_new_motd = get_latest_bulletin()- if motd:- motd = markdown_to_ansi_style(motd)- for motd_line in motd.split("\n"):- logger.info(- extra={- "title": "NEWS:",- "title_color": Fore.GREEN,- "preserve_color": True,- },- msg=motd_line,- )- if is_new_motd and not config.chat_messages_enabled:- input(- Fore.MAGENTA- + Style.BRIGHT- + "NEWS: Bulletin was updated! Press Enter to continue..."- + Style.RESET_ALL- )---def print_git_branch_info(logger: logging.Logger):- git_branch = get_current_git_branch()- if git_branch and git_branch != "stable":- logger.warn(- f"You are running on `{git_branch}` branch"- " - this is not a supported branch."- )---def print_python_version_info(logger: logging.Logger):- if sys.version_info < (3, 10):- logger.error(- "WARNING: You are running on an older version of Python. "- "Some people have observed problems with certain "- "parts of AutoGPT with this version. "- "Please consider upgrading to Python 3.10 or higher.",- )--def _configure_openai_provider(config: Config) -> OpenAIProvider:"""Create a configured OpenAIProvider object.diff --git a/autogpts/autogpt/autogpt/app/utils.py b/autogpts/autogpt/autogpt/app/utils.pyindex 3575490ebe..0c0ae101c8 100644--- a/autogpts/autogpt/autogpt/app/utils.py+++ b/autogpts/autogpt/autogpt/app/utils.py@@ -1,6 +1,7 @@import loggingimport osimport re+import sysimport requestsfrom colorama import Fore, Style@@ -146,3 +147,44 @@ behalf. You acknowledge that using the System could expose you to potential liabBy using the System, you agree to indemnify, defend, and hold harmless the Project Parties from and against any and all claims, liabilities, damages, losses, or expenses (including reasonable attorneys' fees and costs) arising out of or in connection with your use of the System, including, without limitation, any actions taken by the System on your behalf, any failure to properly supervise or monitor the System, and any resulting harm or unintended consequences."""return legal_text+++def print_motd(config: Config, logger: logging.Logger):+ motd, is_new_motd = get_latest_bulletin()+ if motd:+ motd = markdown_to_ansi_style(motd)+ for motd_line in motd.split("\n"):+ logger.info(+ extra={+ "title": "NEWS:",+ "title_color": Fore.GREEN,+ "preserve_color": True,+ },+ msg=motd_line,+ )+ if is_new_motd and not config.chat_messages_enabled:+ input(+ Fore.MAGENTA+ + Style.BRIGHT+ + "NEWS: Bulletin was updated! Press Enter to continue..."+ + Style.RESET_ALL+ )+++def print_git_branch_info(logger: logging.Logger):+ git_branch = get_current_git_branch()+ if git_branch and git_branch != "stable":+ logger.warn(+ f"You are running on `{git_branch}` branch"+ " - this is not a supported branch."+ )+++def print_python_version_info(logger: logging.Logger):+ if sys.version_info < (3, 10):+ logger.error(+ "WARNING: You are running on an older version of Python. "+ "Some people have observed problems with certain "+ "parts of AutoGPT with this version. "+ "Please consider upgrading to Python 3.10 or higher.",+ )