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.

add report method to typewriter_log & load report plugins into logger (#3582)

WladBlank6d2c0c424216
diff --git a/autogpt/logs.py b/autogpt/logs.py
index fcad9efaf5..1cbb784d5e 100644
--- a/autogpt/logs.py
+++ b/autogpt/logs.py
@@ -75,6 +75,7 @@ class Logger(metaclass=Singleton):
self.logger.setLevel(logging.DEBUG)
self.speak_mode = False
+ self.chat_plugins = []
def typewriter_log(
self, title="", title_color="", content="", speak_text=False, level=logging.INFO
@@ -82,6 +83,9 @@ class Logger(metaclass=Singleton):
if speak_text and self.speak_mode:
say_text(f"{title}. {content}")
+ for plugin in self.chat_plugins:
+ plugin.report(f"{title}. {content}")
+
if content:
if isinstance(content, list):
content = " ".join(content)
diff --git a/autogpt/main.py b/autogpt/main.py
index 848a22a0e5..fca8b47ded 100644
--- a/autogpt/main.py
+++ b/autogpt/main.py
@@ -125,6 +125,13 @@ def run_auto_gpt(
full_message_history = []
next_action_count = 0
+ # add chat plugins capable of report to logger
+ if cfg.chat_messages_enabled:
+ for plugin in cfg.plugins:
+ if hasattr(plugin, "can_handle_report") and plugin.can_handle_report():
+ logger.info(f"Loaded plugin into logger: {plugin.__class__.__name__}")
+ logger.chat_plugins.append(plugin)
+
# Initialize memory and make sure it is empty.
# this is particularly important for indexing and referencing pinecone memory
memory = get_memory(cfg, init=True)