From b3c7058e9cee1a0fcb0aac9a7c744f7d0ba9137b Mon Sep 17 00:00:00 2001 From: marsalva Date: Mon, 23 Mar 2026 18:58:57 +0000 Subject: [PATCH] Actualizar server.js --- server.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index e982876..8aca400 100644 --- a/server.js +++ b/server.js @@ -937,6 +937,7 @@ async function procesarConIA(ownerId, mensajeCliente, datosExpediente) { --- CONTEXTO BÁSICO --- - Hoy es: ${fechaHoyTexto}. (Año 2026). - Horario de la empresa: L-V de ${horarios.m_start} a ${horarios.m_end} y de ${horarios.a_start} a ${horarios.a_end}. Fines de semana solo URGENCIAS. + - Problema o Avería reportada por el cliente: ${datosExpediente.averia || 'Avería general (no especificada)'}. --- AGENDA DEL TÉCNICO ASIGNADO --- ${agendaOcupadaTexto} @@ -3789,7 +3790,7 @@ app.post("/services/:id/chat/read", authMiddleware, async (req, res) => { }); // ========================================== -// 💬 CHAT Y COMUNICACIÓN INTERNA (TIPO iTRAMIT) +// 💬 CHAT Y COMUNICACIÓN INTERNA // ========================================== app.get("/services/:id/chat", authMiddleware, async (req, res) => { @@ -3908,7 +3909,8 @@ app.post("/webhook/evolution", async (req, res) => { s.raw_data->>'appointment_status' as appointment_status, s.raw_data->>'requested_date' as cita_pendiente_fecha, s.raw_data->>'requested_time' as cita_pendiente_hora, - s.raw_data->>'Compañía' as compania + s.raw_data->>'Compañía' as compania, + COALESCE(s.raw_data->>'Descripción', s.raw_data->>'DESCRIPCION') as averia FROM scraped_services s LEFT JOIN users u ON s.assigned_to = u.id LEFT JOIN service_statuses st ON (s.raw_data->>'status_operativo')::text = st.id::text @@ -3966,7 +3968,8 @@ app.post("/webhook/evolution", async (req, res) => { appointment_status: service.appointment_status, cita_pendiente_fecha: service.cita_pendiente_fecha, cita_pendiente_hora: service.cita_pendiente_hora, - compania: service.compania // 👈 NUEVO: PASAMOS LA COMPAÑÍA + compania: service.compania, + averia: service.averia // 👈 NUEVO: LE PASAMOS LA AVERÍA AL CEREBRO }); if (respuestaIA) {