feat: IA configurable — probar conexión, activar/inactivar
- Toggle activo/inactivo en configuración → guarda ia_activa en lab_config - Botón "Probar" llama api/lab/test_gemini.php con la clave actual - test_gemini.php envía pregunta mínima a Gemini y confirma respuesta - Dashboard oculta botón y panel IA cuando ia_activa != '1' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3b5c26214c
commit
cd3d3bb9c0
@@ -7,6 +7,12 @@
|
||||
require_once APP_ROOT . '/config/config.php';
|
||||
if (!isUserLoggedIn()) { header('Location: ' . BASE_URL . 'login.php'); exit; }
|
||||
|
||||
$_iaActiva = false;
|
||||
try {
|
||||
$_cfgIA = Database::getInstance()->fetch("SELECT valor FROM lab_config WHERE clave = 'ia_activa'");
|
||||
$_iaActiva = ($_cfgIA['valor'] ?? '0') === '1';
|
||||
} catch (\Throwable $_) {}
|
||||
|
||||
Layout::open('Dashboard Turnero', 'fas fa-chart-bar');
|
||||
?>
|
||||
<style>
|
||||
@@ -191,6 +197,7 @@ Layout::open('Dashboard Turnero', 'fas fa-chart-bar');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($_iaActiva): ?>
|
||||
<!-- ── Botón flotante IA ── -->
|
||||
<button id="btnAI" title="Asistente IA" onclick="toggleAI()">
|
||||
<i class="fas fa-robot"></i>
|
||||
@@ -212,6 +219,7 @@ Layout::open('Dashboard Turnero', 'fas fa-chart-bar');
|
||||
<button class="btn-send" onclick="enviarIA()"><i class="fas fa-paper-plane"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<script>
|
||||
/* ═══════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user