Actualizar server.js
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user