Skip to content

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.

Added ability to output news/announcements on startup

Richard Beales4a077909108c
diff --git a/BULLETIN.md b/BULLETIN.md
new file mode 100644
index 0000000000..735048ddc8
--- /dev/null
+++ b/BULLETIN.md
@@ -0,0 +1,2 @@
+Welcome to Auto-GPT! We'll keep you informed of the latest news and features by printing messages here.
+If you don't wish to see this message, you can run Auto-GPT with the --skip-news flag
\ No newline at end of file
diff --git a/autogpt/cli.py b/autogpt/cli.py
index 8ed9abb0af..323c126b94 100644
--- a/autogpt/cli.py
+++ b/autogpt/cli.py
@@ -42,6 +42,11 @@ import click
is_flag=True,
help="Dangerous: Allows Auto-GPT to download files natively.",
)
+ "--skip-news",
+ is_flag=True,
+ help="Specifies whether to suppress the output of latest news on startup.",
+)
@click.pass_context
def main(
ctx: click.Context,
@@ -56,6 +61,7 @@ def main(
memory_type: str,
browser_name: str,
allow_downloads: bool,
+ skip_news: bool
) -> None:
"""
Welcome to AutoGPT an experimental open-source application showcasing the capabilities of the GPT-4 pushing the boundaries of AI.
@@ -73,6 +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
if ctx.invoked_subcommand is None:
cfg = Config()
@@ -90,9 +97,14 @@ def main(
memory_type,
browser_name,
allow_downloads,
+ skip_news
)
logger.set_level(logging.DEBUG if cfg.debug_mode else logging.INFO)
ai_name = ""
+ if not cfg.skip_news:
+ motd = get_latest_bulletin()
+ if motd:
+ logger.typewriter_log("NEWS: ", Fore.GREEN, motd)
system_prompt = construct_prompt()
# print(prompt)
# Initialize variables
diff --git a/autogpt/config/config.py b/autogpt/config/config.py
index bc75b03192..763882eca3 100644
--- a/autogpt/config/config.py
+++ b/autogpt/config/config.py
@@ -24,6 +24,7 @@ class Config(metaclass=Singleton):
self.speak_mode = False
self.skip_reprompt = False
self.allow_downloads = False
+ self.skip_news = False
self.selenium_web_browser = os.getenv("USE_WEB_BROWSER", "chrome")
self.ai_settings_file = os.getenv("AI_SETTINGS_FILE", "ai_settings.yaml")
diff --git a/autogpt/configurator.py b/autogpt/configurator.py
index 247cdac916..79b0bd0bf2 100644
--- a/autogpt/configurator.py
+++ b/autogpt/configurator.py
@@ -22,6 +22,7 @@ def create_config(
memory_type: str,
browser_name: str,
allow_downloads: bool,
+ skip_news: bool
) -> None:
"""Updates the config object with the given arguments.
@@ -37,7 +38,7 @@ def create_config(
memory_type (str): The type of memory backend to use
browser_name (str): The name of the browser to use when using selenium to scrape the web
allow_downloads (bool): Whether to allow Auto-GPT to download files natively
-
+ skips_news (bool): Whether to suppress the output of latest news on startup
"""
CFG.set_debug_mode(False)
CFG.set_continuous_mode(False)
@@ -126,5 +127,8 @@ def create_config(
)
CFG.allow_downloads = True
+ if skip_news:
+ CFG.skip_news = True
+
if browser_name:
CFG.selenium_web_browser = browser_name
diff --git a/autogpt/utils.py b/autogpt/utils.py
index db7d332136..c7b35b11b1 100644
--- a/autogpt/utils.py
+++ b/autogpt/utils.py
@@ -1,5 +1,6 @@
import yaml
from colorama import Fore
+import requests
def clean_input(prompt: str = ""):
@@ -37,3 +38,11 @@ def readable_file_size(size, decimal_places=2):
break
size /= 1024.0
return f"{size:.{decimal_places}f} {unit}"
+
+def get_latest_bulletin() -> str:
+ try:
+ response = requests.get('https://raw.githubusercontent.com/Significant-Gravitas/Auto-GPT/master/BULLETIN.md')
+ if response.status_code == 200:
+ return response.text
+ except:
+ return ""