This commit is contained in:
Lizandro Guarnizo
2026-05-27 10:16:28 -05:00
parent 5d07fac02d
commit 06d85dc0bf
7 changed files with 540 additions and 2 deletions
@@ -357,3 +357,27 @@ func LandingAdminList(c *fiber.Ctx) error {
"page": page,
})
}
// ─── GET /landing/ai-config ───────────────────────────────────────────────────
// LandingGetAiConfig devuelve la configuración de IA activa para el Landing Generator.
// Protegido por X-Landing-Secret.
func LandingGetAiConfig(c *fiber.Ctx) error {
if !landingSecret(c) {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"error": "no autorizado"})
}
config, err := models.GetActiveAiConfig("qwen")
if err != nil {
// Intentar cualquier provider activo como fallback
config, err = models.GetActiveAiConfig("")
if err != nil {
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "no hay configuración de IA activa"})
}
}
return c.JSON(fiber.Map{
"provider": config.Provider,
"api_key": config.ApiKey,
"base_url": config.BaseURL,
"model_name": config.ModelName,
})
}