From 6b9da87af86fd74e108889f7f12764fac1977682 Mon Sep 17 00:00:00 2001 From: marsalva Date: Sun, 8 Mar 2026 14:46:04 +0000 Subject: [PATCH] Actualizar server.js --- server.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.js b/server.js index d0a2fc4..f874bc7 100644 --- a/server.js +++ b/server.js @@ -3113,6 +3113,13 @@ app.post("/webhook/evolution", async (req, res) => { if (svcQ.rowCount > 0) { const service = svcQ.rows[0]; + // 🛑 NUEVO ESCUDO: Bloquear IA si el estado es finalizado, anulado o desasignado + const nombreEstado = (service.status_name || "").toLowerCase(); + if (nombreEstado.includes('finalizado') || nombreEstado.includes('anulado') || nombreEstado.includes('desasignado')) { + console.log(`🛑 [IA SILENCIADA] El cliente escribió, pero el exp #${service.service_ref} está ${service.status_name}.`); + return; + } + // 🛑 SEMÁFORO ANTI-METRALLETA if (candadosIA.has(service.id)) { return;