@learnpack/learnpack 5.0.231 → 5.0.238
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.d.ts +1 -2
- package/lib/commands/serve.js +8 -109
- package/lib/creatorDist/assets/{index-BjBYI-9r.js → index-x_kA-1DY.js} +8168 -8115
- package/lib/creatorDist/index.html +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/serve.ts +8 -165
- package/src/creator/src/App.tsx +72 -65
- package/src/creator/src/components/LessonItem.tsx +9 -3
- package/src/creator/src/components/NotificationListener.tsx +32 -0
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +42 -44
- package/src/creator/src/utils/creatorUtils.ts +2 -2
- package/src/creator/src/utils/rigo.ts +9 -2
- package/src/creator/src/utils/store.ts +13 -2
- package/src/creatorDist/assets/{index-BjBYI-9r.js → index-x_kA-1DY.js} +8168 -8115
- package/src/creatorDist/index.html +1 -1
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +1 -1
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/configBuilder.ts +1 -2
@@ -14,8 +14,8 @@ export const slugify = (text: string) => {
|
|
14
14
|
.replace(/^-+|-+$/g, "") // Trim hyphens from start/end
|
15
15
|
}
|
16
16
|
|
17
|
-
export const randomUUID = () => {
|
18
|
-
return Math.random().toString(36).substring(2,
|
17
|
+
export const randomUUID = (length = 15) => {
|
18
|
+
return Math.random().toString(36).substring(2, length)
|
19
19
|
}
|
20
20
|
|
21
21
|
export const processImage = async (
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import toast from "react-hot-toast"
|
2
2
|
import { RIGOBOT_HOST, DEV_MODE } from "./constants"
|
3
3
|
import axios, { AxiosError } from "axios"
|
4
|
+
import { randomUUID } from "./creatorUtils"
|
4
5
|
|
5
6
|
type TInteractiveCreationInputs = {
|
6
7
|
courseInfo: string
|
@@ -14,6 +15,12 @@ export const publicInteractiveCreation = async (
|
|
14
15
|
publicRequest: boolean = true
|
15
16
|
): Promise<any | null> => {
|
16
17
|
try {
|
18
|
+
const randomUID = randomUUID(10)
|
19
|
+
const webhookUrl = `${
|
20
|
+
DEV_MODE
|
21
|
+
? "https://9cw5zmww-3000.use2.devtunnels.ms"
|
22
|
+
: window.location.origin
|
23
|
+
}/notifications/${randomUID}`
|
17
24
|
const response = await axios.post(
|
18
25
|
`${RIGOBOT_HOST}/v1/prompting${
|
19
26
|
publicRequest ? "/public" : ""
|
@@ -21,8 +28,8 @@ export const publicInteractiveCreation = async (
|
|
21
28
|
{
|
22
29
|
inputs: inputs,
|
23
30
|
include_purpose_objective: true,
|
24
|
-
execute_async: false,
|
25
31
|
purpose_slug: purposeSlug,
|
32
|
+
webhook_url: webhookUrl,
|
26
33
|
},
|
27
34
|
{
|
28
35
|
headers: {
|
@@ -32,7 +39,7 @@ export const publicInteractiveCreation = async (
|
|
32
39
|
}
|
33
40
|
)
|
34
41
|
|
35
|
-
return response.data
|
42
|
+
return { res: response.data, notificationId: randomUID }
|
36
43
|
} catch (error: unknown) {
|
37
44
|
const err = error as AxiosError
|
38
45
|
console.log("error", err)
|
@@ -53,7 +53,9 @@ type Store = {
|
|
53
53
|
uploadedFiles: ParsedFile[]
|
54
54
|
setUploadedFiles: (uploadedFiles: ParsedFile[]) => void
|
55
55
|
messages: TMessage[]
|
56
|
-
setMessages: (
|
56
|
+
setMessages: (
|
57
|
+
messages: TMessage[] | ((prev: TMessage[]) => TMessage[])
|
58
|
+
) => void
|
57
59
|
cleanHistory: () => void
|
58
60
|
history: Syllabus[]
|
59
61
|
technologies: TTechnology[]
|
@@ -102,7 +104,16 @@ const useStore = create<Store>()(
|
|
102
104
|
messages: [],
|
103
105
|
technologies: [],
|
104
106
|
setTechnologies: (technologies: TTechnology[]) => set({ technologies }),
|
105
|
-
setMessages: (
|
107
|
+
setMessages: (
|
108
|
+
messages: TMessage[] | ((prev: TMessage[]) => TMessage[])
|
109
|
+
) => {
|
110
|
+
set((state) => ({
|
111
|
+
messages:
|
112
|
+
typeof messages === "function"
|
113
|
+
? messages(state.messages)
|
114
|
+
: messages,
|
115
|
+
}))
|
116
|
+
},
|
106
117
|
setFormState: (formState: Partial<FormState>) =>
|
107
118
|
set((state) => ({ formState: { ...state.formState, ...formState } })),
|
108
119
|
resetFormState: () =>
|