Agrega uMind: chat con IA embebible por tenant (F1 — widget web + RAG)
Multi-tenant dentro de soft_usite, reutilizando la infraestructura ya existente (AiConfig, motor de function-calling del agente de Telegram) en vez de un servicio nuevo aparte: - UmindTenant: sitio/cliente con dominios permitidos, config de IA para el chat y personalidad/tono. - Ingesta: crawler simple (mismo dominio, N páginas) + chunking + embeddings (config global con módulo "umind_embeddings", pensada para OpenAI ya que Claude no ofrece embeddings) guardados como JSON, con búsqueda por similitud coseno en memoria (sin pgvector todavía). - Agente acotado: única herramienta buscar_conocimiento, sin acceso a nada interno — si no encuentra la respuesta, lo dice en vez de inventar. - Widget público (/widget/umind.js + /widget/:site_key/*), autenticado por site_key + validación de dominio (Origin/Referer), no por secreto, ya que la key viaja en el HTML público del sitio instalado. - Panel /app/umind: tenants, estado de ingesta, historial de conversaciones por sesión.
This commit is contained in:
@@ -340,6 +340,21 @@ func UserRoutes(app fiber.Router) {
|
||||
protected.Post("/pagos-externos/servicios/:id/regenerar-token", middlewares.SoloAdmin, controllers.RegenerarTokenServicioPagoHandler)
|
||||
protected.Get("/pagos-externos/solicitudes", controllers.GetSolicitudesPagoExternoHandler)
|
||||
|
||||
// ─── uMind: chat con IA embebible por tenant ───────────────────────────────
|
||||
// Sensible: un tenant queda ligado a una config de IA (API key) y controla
|
||||
// desde qué dominios se puede llamar al widget, así que crear/editar es
|
||||
// solo para administradores.
|
||||
protected.Get("/umind", middlewares.MenuMiddleware, controllers.UmindIndex)
|
||||
protected.Get("/umind/tenants", controllers.GetUmindTenants)
|
||||
protected.Post("/umind/tenants", middlewares.SoloAdmin, controllers.CreateUmindTenantHandler)
|
||||
protected.Put("/umind/tenants/:id", middlewares.SoloAdmin, controllers.UpdateUmindTenantHandler)
|
||||
protected.Delete("/umind/tenants/:id", middlewares.SoloAdmin, controllers.DeleteUmindTenantHandler)
|
||||
protected.Get("/umind/documentos", controllers.GetUmindDocumentosHandler)
|
||||
protected.Post("/umind/documentos", middlewares.SoloAdmin, controllers.CreateUmindDocumentoHandler)
|
||||
protected.Delete("/umind/documentos/:id", middlewares.SoloAdmin, controllers.DeleteUmindDocumentoHandler)
|
||||
protected.Get("/umind/sesiones", controllers.GetUmindSesionesHandler)
|
||||
protected.Get("/umind/historial", controllers.GetUmindHistorialHandler)
|
||||
|
||||
// ─── OSS API (Alibaba Cloud + S3/MinIO) ────────────────────────────────────
|
||||
protected.Get("/oss-api", middlewares.MenuMiddleware, controllers.OssApiIndex)
|
||||
protected.Get("/loadossapi", controllers.GetOssApiConfigs)
|
||||
|
||||
Reference in New Issue
Block a user