refactor: use explicit dependency injection for groq_api_key

This commit is contained in:
Re-bin
2026-02-03 06:36:58 +00:00
parent eb20cea668
commit 8989adc9ae
2 changed files with 6 additions and 12 deletions

View File

@@ -36,10 +36,10 @@ class ChannelManager:
if self.config.channels.telegram.enabled:
try:
from nanobot.channels.telegram import TelegramChannel
# Inject parent config for access to providers
self.config.channels.telegram.parent = self.config
self.channels["telegram"] = TelegramChannel(
self.config.channels.telegram, self.bus
self.config.channels.telegram,
self.bus,
groq_api_key=self.config.providers.groq.api_key,
)
logger.info("Telegram channel enabled")
except ImportError as e:
@@ -49,8 +49,6 @@ class ChannelManager:
if self.config.channels.whatsapp.enabled:
try:
from nanobot.channels.whatsapp import WhatsAppChannel
# Inject parent config for access to providers
self.config.channels.whatsapp.parent = self.config
self.channels["whatsapp"] = WhatsAppChannel(
self.config.channels.whatsapp, self.bus
)