mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-16 09:11:03 +08:00
feat: wire NOFXi Agent into Telegram bot
- Add NOFXiAgent interface and SetNOFXiAgent() in telegram/bot.go - Telegram messages now route through the unified agent.Agent instead of the legacy telegram/agent package - Language hint injected from Telegram config for proper i18n - Legacy telegram/agent path preserved as fallback - Agent created before Telegram bot starts in main.go - Build verified, API tested
This commit is contained in:
12
main.go
12
main.go
@@ -142,10 +142,7 @@ func main() {
|
||||
}
|
||||
}()
|
||||
|
||||
// Start Telegram bot (if TELEGRAM_BOT_TOKEN is configured)
|
||||
go telegram.Start(cfg, st, telegramReloadCh)
|
||||
|
||||
// Start NOFXi Agent (proactive intelligence layer)
|
||||
// Start NOFXi Agent (proactive intelligence layer) — must be created BEFORE Telegram bot
|
||||
nofxiAgent := nofxiagent.New(traderManager, st, nil, slog.Default())
|
||||
|
||||
// Try to get an AI client from existing trader configs
|
||||
@@ -164,6 +161,13 @@ func main() {
|
||||
agentWeb := nofxiagent.NewWebHandler(nofxiAgent, slog.Default())
|
||||
server.RegisterAgentHandler(agentWeb)
|
||||
|
||||
// Wire NOFXi Agent into Telegram bot — messages route through the unified agent
|
||||
telegram.SetNOFXiAgent(nofxiAgent)
|
||||
logger.Info("🔗 NOFXi Agent connected to Telegram bot")
|
||||
|
||||
// Start Telegram bot (if token is configured)
|
||||
go telegram.Start(cfg, st, telegramReloadCh)
|
||||
|
||||
logger.Info("🧠 NOFXi Agent started (sentinel + brain + scheduler + web:8900)")
|
||||
|
||||
// Wait for interrupt signal
|
||||
|
||||
Reference in New Issue
Block a user