feat: agente Telegram con IA + Coolify multi-instancia

- Coolify: soporte multi-instancia (CRUD de configs, ?config_id= en todos
  los endpoints, endpoints expandidos para services/databases/teams/envs)
- AiConfig: campos es_agente_bot + telegram_config_id para marcar qué
  config de IA actúa como cerebro del bot administrador
- TelegramAgentHistory + TelegramAgentAuth: historial de conversación por
  chat_id y whitelist de chats autorizados
- Agent Engine: function calling OpenAI-compatible con 25+ herramientas
  (clientes, contratos, contabilidad, proyectos, tickets, tareas,
  Coolify multi-instancia, servidores, monitores URL)
- Webhook POST /webhooks/telegram-agent/:bot_token (público, sin sesión)
- API /api/v2/agent/auth y /api/v2/agent/history para administrar el agente
- AutoMigrate: AiConfig, TelegramAgentHistory, TelegramAgentAuth

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro GD
2026-07-13 18:29:06 +00:00
co-authored by Claude Sonnet 4.6
parent 50812749ea
commit 33cfe4fdb0
10 changed files with 1358 additions and 14 deletions
+4
View File
@@ -37,6 +37,10 @@ func RutasPublicas(web fiber.Router) {
// Configurar en el bot: POST https://api.telegram.org/bot{TOKEN}/setWebhook?url={HOST}/webhooks/telegram-portal
web.Post("/webhooks/telegram-portal", controllers.TelegramPortalWebhook)
// ─── Webhook del agente administrador (bot con IA) ──────────────────────
// Configurar en el bot: POST https://api.telegram.org/bot{TOKEN}/setWebhook?url={HOST}/webhooks/telegram-agent/{BOT_TOKEN}
web.Post("/webhooks/telegram-agent/:bot_token", controllers.TelegramAgentWebhook)
// ─── WebSMS (LabsMobile) — API de envío + webhooks ──────────────────
web.Post("/api/sms/send", controllers.ApiSendSms)
web.Post("/webhooks/websms/delivery", controllers.WebSmsDeliveryWebhook)