@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.
@@ -152,6 +152,7 @@ export type TCompletionJob = {
152
152
  status: "PENDING" | "SUCCESS" | "ERROR" | string;
153
153
  status_text?: string | null;
154
154
  parsed?: Record<string, any> | null;
155
+ ended_at?: string | null;
155
156
  };
156
157
 
157
158
  type TTranslateAndWaitOptions = {
@@ -192,7 +193,8 @@ const assertJobSucceeded = (job: TCompletionJob): TCompletionJob => {
192
193
 
193
194
  export const getCompletionJob = async (
194
195
  token: string,
195
- completionId: number | string
196
+ completionId: number | string,
197
+ options: { timeoutMs?: number } = {}
196
198
  ): Promise<TCompletionJob> => {
197
199
  const response = await axios.get(
198
200
  `${RIGOBOT_HOST}/v1/prompting/completion/${completionId}/`,
@@ -201,6 +203,8 @@ export const getCompletionJob = async (
201
203
  "Content-Type": "application/json",
202
204
  Authorization: "Token " + token,
203
205
  },
206
+ // No timeout by default: the translation polling waits as long as it needs.
207
+ timeout: options.timeoutMs,
204
208
  }
205
209
  )
206
210
 
@@ -847,11 +851,12 @@ type TAddInteractivityInputs = {
847
851
  export const addInteractivity = async (
848
852
  token: string,
849
853
  inputs: TAddInteractivityInputs,
850
- webhookUrl?: string
854
+ webhookUrl?: string,
855
+ templateSlug = "add-lesson-interactivy"
851
856
  ) => {
852
857
  try {
853
858
  const response = await axios.post(
854
- `${RIGOBOT_HOST}/v1/prompting/completion/add-lesson-interactivy/`,
859
+ `${RIGOBOT_HOST}/v1/prompting/completion/${templateSlug}/`,
855
860
  {
856
861
  inputs,
857
862
  include_purpose_objective: false,