Actualizar server.js
This commit is contained in:
@@ -3113,6 +3113,13 @@ app.post("/webhook/evolution", async (req, res) => {
|
|||||||
if (svcQ.rowCount > 0) {
|
if (svcQ.rowCount > 0) {
|
||||||
const service = svcQ.rows[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
|
// 🛑 SEMÁFORO ANTI-METRALLETA
|
||||||
if (candadosIA.has(service.id)) {
|
if (candadosIA.has(service.id)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user