@learnpack/learnpack 5.0.294 → 5.0.295

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.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
+ }