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.
feat(backend): User notification service to send a system alert
Zamil Majdye090195e5794
diff --git a/autogpt_platform/backend/backend/executor/scheduler.py b/autogpt_platform/backend/backend/executor/scheduler.pyindex 05ce759b3b..6b9008d4cc 100644--- a/autogpt_platform/backend/backend/executor/scheduler.py+++ b/autogpt_platform/backend/backend/executor/scheduler.py@@ -20,7 +20,7 @@ from backend.data.block import BlockInputfrom backend.data.execution import ExecutionStatusfrom backend.executor import utils as execution_utilsfrom backend.notifications.notifications import NotificationManagerClient-from backend.util.metrics import discord_send_alert, sentry_capture_error+from backend.util.metrics import sentry_capture_errorfrom backend.util.service import (AppService,AppServiceClient,@@ -112,7 +112,7 @@ def report_late_executions() -> str:)msg = str(error)sentry_capture_error(error)- discord_send_alert(msg)+ get_notification_client().discord_system_alert(msg)return msgdiff --git a/autogpt_platform/backend/backend/notifications/notifications.py b/autogpt_platform/backend/backend/notifications/notifications.pyindex a697269b2d..4bee454cba 100644--- a/autogpt_platform/backend/backend/notifications/notifications.py+++ b/autogpt_platform/backend/backend/notifications/notifications.py@@ -37,6 +37,7 @@ from backend.data.rabbitmq import ()from backend.data.user import generate_unsubscribe_linkfrom backend.notifications.email import EmailSender+from backend.util.metrics import discord_send_alertfrom backend.util.service import (AppService,AppServiceClient,@@ -384,6 +385,10 @@ class NotificationManager(AppService):"timestamp": datetime.now(tz=timezone.utc).isoformat(),}+ @expose+ def discord_system_alert(self, content: str):+ discord_send_alert(content)+def _queue_scheduled_notification(self, event: SummaryParamsEventModel):"""Queue a scheduled notification - exposed method for other services to call"""try:@@ -785,3 +790,4 @@ class NotificationManagerClient(AppServiceClient):process_existing_batches = NotificationManager.process_existing_batchesqueue_weekly_summary = NotificationManager.queue_weekly_summary+ discord_system_alert = NotificationManager.discord_system_alert