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.
Print the current Git branch on startup - warn if unsupported
Richard Beales4ba46307f783
diff --git a/autogpt/cli.py b/autogpt/cli.pyindex a69a53acc3..a2e99cb421 100644--- a/autogpt/cli.py+++ b/autogpt/cli.py@@ -79,7 +79,7 @@ def main(from autogpt.logs import loggerfrom autogpt.memory import get_memoryfrom autogpt.prompt import construct_prompt- from autogpt.utils import get_latest_bulletin+ from autogpt.utils import get_current_git_branch, get_latest_bulletinif ctx.invoked_subcommand is None:cfg = Config()@@ -105,6 +105,14 @@ def main(motd = get_latest_bulletin()if motd:logger.typewriter_log("NEWS: ", Fore.GREEN, motd)+ git_branch = get_current_git_branch()+ if git_branch and git_branch != "stable":+ logger.typewriter_log(+ "WARNING: ",+ Fore.RED,+ f"You are running on `{git_branch}` branch "+ "- this is not a supported branch.",+ )system_prompt = construct_prompt()# print(prompt)# Initialize variablesdiff --git a/autogpt/utils.py b/autogpt/utils.pyindex 0f52c060f9..e93d5ac740 100644--- a/autogpt/utils.py+++ b/autogpt/utils.py@@ -3,6 +3,7 @@ import osimport requestsimport yamlfrom colorama import Fore+from git import Repodef clean_input(prompt: str = ""):@@ -53,6 +54,15 @@ def get_bulletin_from_web() -> str:return ""+def get_current_git_branch() -> str:+ try:+ repo = Repo(search_parent_directories=True)+ branch = repo.active_branch+ return branch.name+ except:+ return ""++def get_latest_bulletin() -> str:exists = os.path.exists("CURRENT_BULLETIN.md")current_bulletin = ""