@learnpack/learnpack 5.0.294 → 5.0.296

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.
package/src/ui/_app/sw.js CHANGED
@@ -21,15 +21,39 @@ self.addEventListener('install', (event) => {
21
21
  });
22
22
 
23
23
  self.addEventListener('fetch', (event) => {
24
- // Excluir solicitudes a /socket.io/
25
- if (event.request.url.includes('/socket.io/')) {
26
- // No interceptar, que siga el flujo normal
24
+ // Excluir solicitudes a /socket.io/ y otras URLs que no deben ser cacheadas
25
+ if (event.request.url.includes('/socket.io/') ||
26
+ event.request.url.includes('/api/') ||
27
+ event.request.url.includes('localhost') ||
28
+ event.request.url.includes('devtunnels')) {
27
29
  return;
28
30
  }
29
31
 
30
32
  event.respondWith(
31
33
  caches.match(event.request).then((response) => {
32
- return response || fetch(event.request);
34
+ if (response) {
35
+ return response;
36
+ }
37
+
38
+ // Solo hacer fetch para recursos estáticos
39
+ if (event.request.method === 'GET' &&
40
+ (event.request.url.includes('.js') ||
41
+ event.request.url.includes('.css') ||
42
+ event.request.url.includes('.png') ||
43
+ event.request.url.includes('.jpg') ||
44
+ event.request.url.includes('.ico') ||
45
+ event.request.url.includes('.svg'))) {
46
+ return fetch(event.request).catch(() => {
47
+ // Si falla el fetch, devolver una respuesta básica
48
+ return new Response('Resource not available', { status: 404 });
49
+ });
50
+ }
51
+
52
+ // Para otras solicitudes, no interceptar
53
+ return fetch(event.request);
54
+ }).catch(() => {
55
+ // En caso de error, devolver respuesta básica
56
+ return new Response('Service worker error', { status: 500 });
33
57
  })
34
58
  );
35
59
  });
package/src/ui/app.tar.gz CHANGED
Binary file
@@ -574,3 +574,36 @@ export const addInteractivity = async (
574
574
  return null
575
575
  }
576
576
  }
577
+
578
+ type TGenerateCodeChallengeInputs = {
579
+ lesson_content: string;
580
+ challenge_proposal: string;
581
+ };
582
+
583
+ export const generateCodeChallenge = async (
584
+ token: string,
585
+ inputs: TGenerateCodeChallengeInputs,
586
+ webhookUrl?: string
587
+ ) => {
588
+ try {
589
+ const response = await axios.post(
590
+ `${RIGOBOT_HOST}/v1/prompting/completion/generate-code-challenge-files/`,
591
+ {
592
+ inputs,
593
+ include_purpose_objective: false,
594
+ execute_async: !!webhookUrl,
595
+ webhook_url: webhookUrl,
596
+ },
597
+ {
598
+ headers: {
599
+ "Content-Type": "application/json",
600
+ Authorization: "Token " + token.trim(),
601
+ },
602
+ }
603
+ )
604
+ return response.data
605
+ } catch (error) {
606
+ console.error("Error in generateCodeChallenge:", error)
607
+ return null
608
+ }
609
+ }