@runnerpro/backend 1.13.21 → 1.13.22

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.
@@ -241,7 +241,7 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, isClient }
241
241
  idWorkout = newMessage.idWorkout;
242
242
  }
243
243
  const [message] = yield (0, index_1.query)('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [REPLY MESSAGE ID], [ID WORKOUT], [TYPE]) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING [ID]', [isClient ? userid : idCliente, userid, textSpanish, textPreferredLanguage, preferredLanguage, replyMessageId, idWorkout, type]);
244
- res.send({ idMessage: message.id });
244
+ res.send({ idMessage: message.id, text: textSpanish });
245
245
  if (!isClient) {
246
246
  sendNotification({
247
247
  firebaseMessaging,
@@ -13,10 +13,9 @@ exports.sendPrompt = void 0;
13
13
  const { VertexAI } = require('@google-cloud/vertexai');
14
14
  function sendPrompt(prompt) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
- console.log(process.env.GOOGLE_APPLICATION_CREDENTIALS);
17
16
  // Inicializa el cliente de Vertex AI
18
17
  const vertex_ai = new VertexAI({
19
- project: 'glass-timing-393523', // Reemplaza con tu ID de proyecto de Google Cloud
18
+ project: process.env.PROJECT_ID, // Reemplaza con tu ID de proyecto de Google Cloud
20
19
  location: 'us-central1', // Reemplaza con tu región
21
20
  });
22
21
  // Selecciona el modelo de Gemini
@@ -25,19 +24,13 @@ function sendPrompt(prompt) {
25
24
  const generativeModel = vertex_ai.preview.getGenerativeModel({
26
25
  model: model,
27
26
  });
28
- console.log(`Enviando prompt: "${prompt}"`);
29
27
  try {
30
28
  const resp = yield generativeModel.generateContent(prompt);
31
29
  const content = resp.response.candidates[0].content;
32
30
  // Asumiendo que la respuesta es de tipo texto
33
- if (content.parts && content.parts.length > 0 && content.parts[0].text) {
34
- console.log('Respuesta de Gemini:');
35
- console.log(content.parts[0].text);
31
+ if (content.parts && content.parts.length > 0 && content.parts[0].text)
36
32
  return content.parts[0].text;
37
- }
38
- else {
39
- console.log('No se recibió una respuesta de texto válida.');
40
- }
33
+ return '';
41
34
  }
42
35
  catch (error) {
43
36
  console.error('Error al enviar el prompt:', error);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAEA,iBAAe,UAAU,CAAC,MAAM,KAAA,gBAiC/B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAEA,iBAAe,UAAU,CAAC,MAAM,KAAA,gBA0B/B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.13.21",
3
+ "version": "1.13.22",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"