Merge branch 'master' into fix/default-config

This commit is contained in:
Reinier van der Leer
2023-04-19 18:13:41 +02:00
8 changed files with 27 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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

View File

@@ -145,7 +145,7 @@ class Config(metaclass=Singleton):
else:
return ""
AZURE_CONFIG_FILE = os.path.join(os.path.dirname(__file__), "..", "azure.yaml")
AZURE_CONFIG_FILE = os.path.join(os.path.dirname(__file__), "../..", "azure.yaml")
def load_azure_config(self, config_file: str = AZURE_CONFIG_FILE) -> None:
"""
@@ -168,7 +168,7 @@ class Config(metaclass=Singleton):
self.openai_api_version = (
config_params.get("azure_api_version") or "2023-03-15-preview"
)
self.azure_model_to_deployment_id_map = config_params.get("azure_model_map", [])
self.azure_model_to_deployment_id_map = config_params.get("azure_model_map", {})
def set_continuous_mode(self, value: bool) -> None:
"""Set the continuous mode value."""

View File

@@ -62,7 +62,7 @@ def summarize_text(
print(f"Text length: {text_length} characters")
summaries = []
chunks = list(split_text(text))
chunks = list(split_text(text, CFG.browse_chunk_max_length))
scroll_ratio = 1 / len(chunks)
for i, chunk in enumerate(chunks):

View File

@@ -85,7 +85,6 @@ def get_prompt() -> str:
{"code": "<full_code_string>", "focus": "<list_of_focus_areas>"},
),
("Execute Python File", "execute_python_file", {"file": "<file>"}),
("Task Complete (Shutdown)", "task_complete", {"reason": "<reason>"}),
("Generate Image", "generate_image", {"prompt": "<prompt>"}),
("Send Tweet", "send_tweet", {"text": "<text>"}),
]

View File

@@ -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 = ""

View File

@@ -1,4 +1,4 @@
azure_api_type: azure_ad
azure_api_type: azure
azure_api_base: your-base-url-for-azure
azure_api_version: api-version-for-azure
azure_model_map:

View File

@@ -27,7 +27,6 @@ flake8
numpy
pre-commit
black
sourcery
isort
gitpython==3.1.31