@learnpack/learnpack 5.0.363 → 5.0.365
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/lib/commands/serve.js +482 -286
- package/lib/models/creator.d.ts +1 -0
- package/lib/utils/continueGeneration.d.ts +65 -0
- package/lib/utils/continueGeneration.js +82 -0
- package/lib/utils/generationRetry.d.ts +48 -0
- package/lib/utils/generationRetry.js +81 -0
- package/lib/utils/interactivity/componentsGuide.d.ts +50 -0
- package/lib/utils/interactivity/componentsGuide.js +193 -0
- package/lib/utils/interactivity/interactivityPlan.d.ts +20 -0
- package/lib/utils/interactivity/interactivityPlan.js +33 -0
- package/lib/utils/interactivity/structuredComponents.d.ts +34 -0
- package/lib/utils/interactivity/structuredComponents.js +792 -0
- package/lib/utils/rigoActions.d.ts +5 -2
- package/lib/utils/rigoActions.js +5 -3
- package/package.json +1 -1
- package/src/commands/serve.ts +720 -408
- package/src/models/creator.ts +87 -84
- package/src/ui/_app/app.js +130 -72
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/continueGeneration.ts +108 -0
- package/src/utils/generationRetry.ts +100 -0
- package/src/utils/interactivity/componentsGuide.ts +294 -0
- package/src/utils/interactivity/interactivityPlan.ts +57 -0
- package/src/utils/interactivity/structuredComponents.ts +1004 -0
- package/src/utils/rigoActions.ts +8 -3
|
@@ -26,6 +26,7 @@ export type TCompletionJob = {
|
|
|
26
26
|
status: "PENDING" | "SUCCESS" | "ERROR" | string;
|
|
27
27
|
status_text?: string | null;
|
|
28
28
|
parsed?: Record<string, any> | null;
|
|
29
|
+
ended_at?: string | null;
|
|
29
30
|
};
|
|
30
31
|
type TTranslateAndWaitOptions = {
|
|
31
32
|
/** How often the job status is checked while it is still running. */
|
|
@@ -35,7 +36,9 @@ type TTranslateAndWaitOptions = {
|
|
|
35
36
|
/** Called after every successful poll, useful to keep a heartbeat alive. */
|
|
36
37
|
onPoll?: (job: TCompletionJob) => void | Promise<void>;
|
|
37
38
|
};
|
|
38
|
-
export declare const getCompletionJob: (token: string, completionId: number | string
|
|
39
|
+
export declare const getCompletionJob: (token: string, completionId: number | string, options?: {
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}) => Promise<TCompletionJob>;
|
|
39
42
|
export declare const translateExerciseAndWait: (token: string, inputs: TTranslateInputs, options?: TTranslateAndWaitOptions) => Promise<TCompletionJob>;
|
|
40
43
|
type TGenerateCourseIntroductionInputs = {
|
|
41
44
|
course_title: string;
|
|
@@ -167,7 +170,7 @@ type TAddInteractivityInputs = {
|
|
|
167
170
|
lesson_info: string;
|
|
168
171
|
current_syllabus: string;
|
|
169
172
|
};
|
|
170
|
-
export declare const addInteractivity: (token: string, inputs: TAddInteractivityInputs, webhookUrl?: string) => Promise<any>;
|
|
173
|
+
export declare const addInteractivity: (token: string, inputs: TAddInteractivityInputs, webhookUrl?: string, templateSlug?: string) => Promise<any>;
|
|
171
174
|
type TGenerateCodeChallengeInputs = {
|
|
172
175
|
lesson_content: string;
|
|
173
176
|
challenge_proposal: string;
|
package/lib/utils/rigoActions.js
CHANGED
|
@@ -114,12 +114,14 @@ const assertJobSucceeded = (job) => {
|
|
|
114
114
|
}
|
|
115
115
|
return job;
|
|
116
116
|
};
|
|
117
|
-
const getCompletionJob = async (token, completionId) => {
|
|
117
|
+
const getCompletionJob = async (token, completionId, options = {}) => {
|
|
118
118
|
const response = await axios_1.default.get(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/${completionId}/`, {
|
|
119
119
|
headers: {
|
|
120
120
|
"Content-Type": "application/json",
|
|
121
121
|
Authorization: "Token " + token,
|
|
122
122
|
},
|
|
123
|
+
// No timeout by default: the translation polling waits as long as it needs.
|
|
124
|
+
timeout: options.timeoutMs,
|
|
123
125
|
});
|
|
124
126
|
return response.data;
|
|
125
127
|
};
|
|
@@ -479,9 +481,9 @@ const generateStepDescriptions = async (token, params, endpointSlug = "generate-
|
|
|
479
481
|
}
|
|
480
482
|
};
|
|
481
483
|
exports.generateStepDescriptions = generateStepDescriptions;
|
|
482
|
-
const addInteractivity = async (token, inputs, webhookUrl) => {
|
|
484
|
+
const addInteractivity = async (token, inputs, webhookUrl, templateSlug = "add-lesson-interactivy") => {
|
|
483
485
|
try {
|
|
484
|
-
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion
|
|
486
|
+
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/${templateSlug}/`, {
|
|
485
487
|
inputs,
|
|
486
488
|
include_purpose_objective: false,
|
|
487
489
|
execute_async: !!webhookUrl,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learnpack/learnpack",
|
|
3
3
|
"description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.365",
|
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
|
6
6
|
"contributors": [
|
|
7
7
|
{
|