@runnerpro/backend 1.13.25 → 1.13.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -220,23 +220,14 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, isClient }
|
|
|
220
220
|
const idCliente = isClient ? req.session.userid : req.body.idCliente;
|
|
221
221
|
let idWorkout, type = 1;
|
|
222
222
|
if (!isClient) {
|
|
223
|
-
console.time('
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
text = yield cambiarTonoEntrenadorNeutro(text);
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
console.error('Error en cambiarTonoEntrenadorNeutro:', error);
|
|
235
|
-
}
|
|
236
|
-
finally {
|
|
237
|
-
console.timeEnd('cambiarTonoEntrenadorNeutro');
|
|
238
|
-
}
|
|
239
|
-
}
|
|
223
|
+
console.time('promise all 1');
|
|
224
|
+
[text] = yield Promise.all([
|
|
225
|
+
// Cambiar el tono del texto a uno neutro y corregir la ortografía
|
|
226
|
+
cambiarTonoEntrenadorNeutro(text, idCliente),
|
|
227
|
+
// Si es entrenador, se marca leído cuando se envía un mensaje
|
|
228
|
+
getPreferredLanguageForChat({ text, idCliente, isClient }),
|
|
229
|
+
]);
|
|
230
|
+
console.timeEnd('promise all 1');
|
|
240
231
|
}
|
|
241
232
|
// Devuelve el texto en el otro idioma si el cliente no habla español y el idioma del cliente
|
|
242
233
|
console.time('getPreferredLanguageForChat');
|
|
@@ -419,9 +410,11 @@ const markReadMessage = ({ isClient, idCliente }) => __awaiter(void 0, void 0, v
|
|
|
419
410
|
if (!isClient)
|
|
420
411
|
yield (0, saveResponseTime_1.saveResponseTime)(idCliente);
|
|
421
412
|
});
|
|
422
|
-
const cambiarTonoEntrenadorNeutro = (text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
423
|
-
|
|
413
|
+
const cambiarTonoEntrenadorNeutro = (text, idCliente) => __awaiter(void 0, void 0, void 0, function* () {
|
|
414
|
+
if (idCliente !== 'sJzhGqaJcddq96x80hZAlPJ6pET2')
|
|
415
|
+
return text;
|
|
424
416
|
try {
|
|
417
|
+
console.time('sendPrompt');
|
|
425
418
|
const textCorregido = yield (0, prompt_1.sendPrompt)(`
|
|
426
419
|
Actúa como un asistente de comunicación para entrenadores. Tu objetivo es revisar el siguiente mensaje de un entrenador a un cliente. Debes corregir cualquier falta de ortografía y reescribir el texto para que tenga un tono profesional y constructivo.
|
|
427
420
|
|
|
@@ -431,11 +424,10 @@ const cambiarTonoEntrenadorNeutro = (text) => __awaiter(void 0, void 0, void 0,
|
|
|
431
424
|
|
|
432
425
|
Devuelve solo el texto corregido y reescrito, sin añadir explicaciones.
|
|
433
426
|
`);
|
|
434
|
-
console.
|
|
427
|
+
console.timeEnd('sendPrompt');
|
|
435
428
|
return textCorregido;
|
|
436
429
|
}
|
|
437
430
|
catch (error) {
|
|
438
|
-
console.log('error', error);
|
|
439
431
|
return text;
|
|
440
432
|
}
|
|
441
433
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAuBpD,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAuBpD,CAAC;AAybF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|