Initial commit: CI Agent competitive-intelligence monitoring app
FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring, source collection, LLM-based change analysis, enrichment, and account security (Turnstile, escalating lockout, email verification).
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""Resolves a NotificationType to a concrete provider. Console is always
|
||||
available and never costs anything; email/SMS are only meaningfully
|
||||
configured when their settings are present (callers gate on
|
||||
NOTIFICATION_SMS_ENABLED before ever routing to SMS - see alert_service.py).
|
||||
|
||||
SMS has two interchangeable vendor providers (`SMS_PROVIDER=twilio|telnyx`),
|
||||
same pattern as LLM_PROVIDER/SEARCH_PROVIDER elsewhere in the app - swapping
|
||||
the setting changes which class this returns and nothing else has to change.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.core.config import Settings
|
||||
from app.models.enums import NotificationType
|
||||
from app.notifications.base import NotificationProvider
|
||||
from app.notifications.console import ConsoleProvider
|
||||
from app.notifications.smtp_email import SmtpEmailProvider
|
||||
from app.notifications.telnyx_sms import TelnyxSmsProvider
|
||||
from app.notifications.twilio_sms import TwilioSmsProvider
|
||||
|
||||
|
||||
def get_notification_provider(
|
||||
notification_type: NotificationType, settings: Settings
|
||||
) -> NotificationProvider:
|
||||
if notification_type == NotificationType.EMAIL:
|
||||
return SmtpEmailProvider(settings)
|
||||
if notification_type == NotificationType.SMS:
|
||||
if settings.sms_provider == "telnyx":
|
||||
return TelnyxSmsProvider(settings)
|
||||
return TwilioSmsProvider(settings)
|
||||
return ConsoleProvider()
|
||||
Reference in New Issue
Block a user