@runnerpro/backend 1.13.30 → 1.13.31

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.
@@ -415,20 +415,14 @@ const cambiarTonoEntrenadorNeutro = (text, idCliente) => __awaiter(void 0, void
415
415
  return text;
416
416
  try {
417
417
  console.time('sendPrompt');
418
- const textCorregido = yield (0, prompt_1.sendPrompt)(`
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.
420
-
421
- * MENSAJE ORIGINAL INICIO *
422
- ${text}
423
- * MENSAJE ORIGINAL FIN *
424
-
425
- Devuelve solo el texto corregido y reescrito, sin añadir explicaciones.
426
- `);
418
+ // Prompt simplificado para testing
419
+ const textCorregido = yield (0, prompt_1.sendPrompt)(`Corrige este texto: ${text}`);
427
420
  console.log('textCorregido', textCorregido);
428
421
  console.timeEnd('sendPrompt');
429
422
  return textCorregido;
430
423
  }
431
424
  catch (error) {
425
+ console.error('Error completo:', error);
432
426
  return text;
433
427
  }
434
428
  });
@@ -24,8 +24,8 @@ function sendPrompt(prompt, options = {}) {
24
24
  const generativeModel = vertex_ai.preview.getGenerativeModel({
25
25
  model: model,
26
26
  generationConfig: {
27
- maxOutputTokens: options.maxOutputTokens || 512, // Limitar tokens para respuestas más rápidas
28
- temperature: options.temperature || 0.3, // Menor temperatura = más determinístico y rápido
27
+ maxOutputTokens: options.maxOutputTokens || 512,
28
+ temperature: options.temperature || 0.3,
29
29
  topP: options.topP || 0.8,
30
30
  topK: options.topK || 20,
31
31
  },
@@ -34,12 +34,39 @@ function sendPrompt(prompt, options = {}) {
34
34
  console.log('generativeModel', generativeModel);
35
35
  try {
36
36
  const resp = yield generativeModel.generateContent(prompt);
37
- console.log('resp', resp.response.candidates[0].content);
38
- const content = resp.response.candidates[0].content;
39
- // Asumiendo que la respuesta es de tipo texto
40
- console.log('content', content.parts);
41
- if (content.parts && content.parts.length > 0 && content.parts[0].text)
42
- return content.parts[0].text;
37
+ // Debug completo de la respuesta
38
+ console.log('=== RESPUESTA COMPLETA ===');
39
+ console.log('resp completo:', JSON.stringify(resp, null, 2));
40
+ console.log('=== RESPONSE ===');
41
+ console.log('resp.response:', JSON.stringify(resp.response, null, 2));
42
+ console.log('=== CANDIDATES ===');
43
+ console.log('candidates:', resp.response.candidates);
44
+ if (resp.response.candidates && resp.response.candidates[0]) {
45
+ console.log('=== PRIMER CANDIDATE ===');
46
+ console.log('candidate[0]:', JSON.stringify(resp.response.candidates[0], null, 2));
47
+ const content = resp.response.candidates[0].content;
48
+ console.log('=== CONTENT ===');
49
+ console.log('content:', JSON.stringify(content, null, 2));
50
+ // Asumiendo que la respuesta es de tipo texto
51
+ console.log('=== PARTS ===');
52
+ console.log('content.parts:', content.parts);
53
+ if (content.parts && content.parts.length > 0) {
54
+ console.log('parts[0]:', JSON.stringify(content.parts[0], null, 2));
55
+ if (content.parts[0].text) {
56
+ console.log('text encontrado:', content.parts[0].text);
57
+ return content.parts[0].text;
58
+ }
59
+ else {
60
+ console.log('ERROR: parts[0].text es undefined');
61
+ }
62
+ }
63
+ else {
64
+ console.log('ERROR: content.parts está undefined o vacío');
65
+ }
66
+ }
67
+ else {
68
+ console.log('ERROR: No hay candidates en la respuesta');
69
+ }
43
70
  return '';
44
71
  }
45
72
  catch (error) {
@@ -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;AA0bF,OAAO,EAAE,iBAAiB,EAAE,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;AAsbF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAe,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,gBAsCxE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAe,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,gBAqExE;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.30",
3
+ "version": "1.13.31",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"