diff --git a/autogpt/logs.py b/autogpt/logs.py index fcad9efaf588..1cbb784d5e48 100644 --- a/autogpt/logs.py +++ b/autogpt/logs.py @@ -75,6 +75,7 @@ def __init__(self): 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 @@ def typewriter_log( 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 848a22a0e5a2..fca8b47dedf7 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)