@learnpack/learnpack 5.0.240 → 5.0.246
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/publish.d.ts +1 -1
- package/lib/commands/publish.js +19 -14
- package/lib/commands/serve.js +87 -100
- package/lib/creatorDist/assets/{index-DJn8b8wj.js → index-CZYzWk3G.js} +3044 -3045
- package/lib/creatorDist/index.html +1 -1
- package/lib/models/creator.d.ts +1 -0
- package/lib/utils/api.d.ts +1 -0
- package/lib/utils/api.js +1 -1
- package/lib/utils/creatorSocket.d.ts +1 -1
- package/lib/utils/creatorSocket.js +10 -3
- package/lib/utils/rigoActions.d.ts +5 -0
- package/lib/utils/rigoActions.js +11 -1
- package/package.json +1 -1
- package/src/commands/publish.ts +26 -24
- package/src/commands/serve.ts +160 -140
- package/src/creator/src/App.tsx +3 -1
- package/src/creator/src/components/NotificationListener.tsx +1 -1
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +12 -16
- package/src/creator/src/utils/rigo.ts +3 -2
- package/src/creator/src/utils/store.ts +4 -1
- package/src/creatorDist/assets/{index-DJn8b8wj.js → index-CZYzWk3G.js} +3044 -3045
- package/src/creatorDist/index.html +1 -1
- package/src/models/creator.ts +1 -0
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +367 -367
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/api.ts +2 -1
- package/src/utils/creatorSocket.ts +22 -16
- package/src/utils/rigoActions.ts +22 -0
package/src/ui/app.tar.gz
CHANGED
Binary file
|
package/src/utils/api.ts
CHANGED
@@ -427,6 +427,7 @@ type TAssetMissing = {
|
|
427
427
|
author: number
|
428
428
|
preview: string
|
429
429
|
readme_raw: string
|
430
|
+
all_translations: string[]
|
430
431
|
}
|
431
432
|
|
432
433
|
export const createAsset = async (token: string, asset: TAssetMissing) => {
|
@@ -535,7 +536,7 @@ const updateRigoAssetID = async (
|
|
535
536
|
) => {
|
536
537
|
const url = `${RIGOBOT_HOST}/v1/learnpack/package/${slug}/`
|
537
538
|
const headers = {
|
538
|
-
Authorization: `Token ${token}`,
|
539
|
+
Authorization: `Token ${token.trim()}`,
|
539
540
|
}
|
540
541
|
try {
|
541
542
|
const response = await axios.put(url, { asset_id }, { headers })
|
@@ -22,8 +22,7 @@ export function initSocketIO(server: any) {
|
|
22
22
|
|
23
23
|
socket.on("register", (data: { courseSlug: string }) => {
|
24
24
|
const { courseSlug } = data
|
25
|
-
if (!courseSlug)
|
26
|
-
return
|
25
|
+
if (!courseSlug) return
|
27
26
|
|
28
27
|
if (!courseSocketMap.has(courseSlug)) {
|
29
28
|
courseSocketMap.set(courseSlug, new Set())
|
@@ -35,8 +34,7 @@ return
|
|
35
34
|
|
36
35
|
socket.on("registerNotification", (data: { notificationId: string }) => {
|
37
36
|
const { notificationId } = data
|
38
|
-
if (!notificationId)
|
39
|
-
return
|
37
|
+
if (!notificationId) return
|
40
38
|
|
41
39
|
if (!notificationSocketMap.has(notificationId)) {
|
42
40
|
notificationSocketMap.set(notificationId, new Set())
|
@@ -63,31 +61,39 @@ return
|
|
63
61
|
|
64
62
|
export function emitToCourse(courseSlug: string, event: string, payload: any) {
|
65
63
|
const socketIds = courseSocketMap.get(courseSlug)
|
66
|
-
if (!socketIds || socketIds.size === 0)
|
67
|
-
return
|
64
|
+
if (!socketIds || socketIds.size === 0) return
|
68
65
|
|
69
66
|
for (const id of socketIds) {
|
70
67
|
const socket = socketStore.get(id)
|
71
|
-
if (socket)
|
72
|
-
socket.emit(event, payload)
|
68
|
+
if (socket) socket.emit(event, payload)
|
73
69
|
}
|
74
70
|
}
|
75
71
|
|
76
|
-
export function emitToNotification(
|
77
|
-
|
72
|
+
export function emitToNotification(
|
73
|
+
notificationId: string,
|
74
|
+
payload: any,
|
75
|
+
retry = 0
|
76
|
+
) {
|
78
77
|
const socketIds = notificationSocketMap.get(notificationId)
|
79
|
-
if (!socketIds || socketIds.size === 0)
|
80
|
-
|
78
|
+
if (!socketIds || socketIds.size === 0) {
|
79
|
+
if (retry > 3) {
|
80
|
+
console.log("❌ Notification", notificationId, "not found")
|
81
|
+
return
|
82
|
+
}
|
83
|
+
|
84
|
+
setTimeout(() => {
|
85
|
+
emitToNotification(notificationId, payload, retry + 1)
|
86
|
+
}, 3000)
|
87
|
+
return
|
88
|
+
}
|
81
89
|
|
82
90
|
for (const id of socketIds) {
|
83
91
|
const socket = socketStore.get(id)
|
84
|
-
if (socket)
|
85
|
-
socket.emit(notificationId, payload)
|
92
|
+
if (socket) socket.emit(notificationId, payload)
|
86
93
|
}
|
87
94
|
}
|
88
95
|
|
89
96
|
export function getSocketIO() {
|
90
|
-
if (!io)
|
91
|
-
throw new Error("Socket.IO not initialized")
|
97
|
+
if (!io) throw new Error("Socket.IO not initialized")
|
92
98
|
return io
|
93
99
|
}
|
package/src/utils/rigoActions.ts
CHANGED
@@ -330,6 +330,28 @@ export const createStructuredPreviewReadme = async (
|
|
330
330
|
return response.data
|
331
331
|
}
|
332
332
|
|
333
|
+
export const translateCourseMetadata = async (
|
334
|
+
token: string,
|
335
|
+
inputs: {
|
336
|
+
title: string
|
337
|
+
description: string
|
338
|
+
destination_lang_code: string
|
339
|
+
}
|
340
|
+
) => {
|
341
|
+
const response = await axios.post(
|
342
|
+
`${RIGOBOT_HOST}/v1/prompting/completion/translate-course-metadata/`,
|
343
|
+
{ inputs, include_purpose_objective: false, execute_async: false },
|
344
|
+
{
|
345
|
+
headers: {
|
346
|
+
"Content-Type": "application/json",
|
347
|
+
Authorization: "Token " + token,
|
348
|
+
},
|
349
|
+
}
|
350
|
+
)
|
351
|
+
|
352
|
+
return response.data
|
353
|
+
}
|
354
|
+
|
333
355
|
export async function createPreviewReadme(
|
334
356
|
tutorialDir: string,
|
335
357
|
packageInfo: PackageInfo,
|