mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-18 05:24:22 +01:00
Merge pull request #2494 from richbeales/master
Print the current Git branch on startup - warn if unsupported
This commit is contained in:
@@ -79,7 +79,7 @@ def main(
|
||||
from autogpt.logs import logger
|
||||
from autogpt.memory import get_memory
|
||||
from autogpt.prompt import construct_prompt
|
||||
from autogpt.utils import get_latest_bulletin
|
||||
from autogpt.utils import get_current_git_branch, get_latest_bulletin
|
||||
|
||||
if 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 variables
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import requests
|
||||
import yaml
|
||||
from colorama import Fore
|
||||
from git import Repo
|
||||
|
||||
|
||||
def 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 = ""
|
||||
|
||||
Reference in New Issue
Block a user