@learnpack/learnpack 5.0.186 → 5.0.191
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/README.md +13 -13
- package/lib/commands/init.js +2 -2
- package/lib/commands/serve.d.ts +2 -1
- package/lib/commands/serve.js +9 -53
- package/lib/creatorDist/assets/index-Bnq3eZ3T.css +1 -1641
- package/lib/creatorDist/assets/index-CXaPa6wN.js +273 -0
- package/lib/creatorDist/index.html +1 -1
- package/lib/utils/rigoActions.d.ts +4 -4
- package/lib/utils/rigoActions.js +14 -8
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +23 -15
- package/src/commands/serve.ts +36 -80
- package/src/creator/src/App.tsx +3 -2
- package/src/creator/src/components/FileUploader.tsx +87 -10
- package/src/creator/src/components/Login.tsx +24 -18
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +47 -34
- package/src/creator/src/utils/rigo.ts +7 -6
- package/src/creatorDist/assets/index-Bnq3eZ3T.css +1 -1641
- package/src/creatorDist/assets/index-CXaPa6wN.js +273 -0
- package/src/creatorDist/index.html +1 -1
- package/src/utils/rigoActions.ts +28 -14
- package/lib/creatorDist/assets/index-Cq3XE9_M.js +0 -35362
- package/src/creatorDist/assets/index-Cq3XE9_M.js +0 -35362
@@ -132,42 +132,55 @@ const SyllabusEditor: React.FC = () => {
|
|
132
132
|
const sendPrompt = async (prompt: string) => {
|
133
133
|
setIsThinking(true)
|
134
134
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
try {
|
136
|
+
setMessages([
|
137
|
+
...messages,
|
138
|
+
{ type: "user", content: prompt },
|
139
|
+
{ type: "assistant", content: "" },
|
140
|
+
])
|
140
141
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
142
|
+
const res = await publicInteractiveCreation(
|
143
|
+
{
|
144
|
+
courseInfo: JSON.stringify(syllabus.courseInfo),
|
145
|
+
prevInteractions:
|
146
|
+
messages
|
147
|
+
.map((message) => `${message.type}: ${message.content}`)
|
148
|
+
.join("\n") + `\nUSER: ${prompt}`,
|
149
|
+
},
|
150
|
+
auth.rigoToken ? auth.rigoToken : auth.publicToken,
|
151
|
+
syllabus?.courseInfo?.purpose || "learnpack-lesson-writer",
|
152
|
+
auth.rigoToken ? false : true
|
153
|
+
)
|
152
154
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
155
|
+
const lessons: Lesson[] = res.parsed.listOfSteps.map((step: any) =>
|
156
|
+
parseLesson(step, syllabus.lessons)
|
157
|
+
)
|
158
|
+
push({
|
159
|
+
...syllabus,
|
160
|
+
lessons: lessons,
|
161
|
+
courseInfo: {
|
162
|
+
...syllabus.courseInfo,
|
163
|
+
title: res.parsed.title || syllabus.courseInfo.title,
|
164
|
+
description:
|
165
|
+
res.parsed.description || syllabus.courseInfo.description,
|
166
|
+
},
|
167
|
+
})
|
168
|
+
setMessages((prev) => {
|
169
|
+
const newMessages = [...prev]
|
170
|
+
newMessages[newMessages.length - 1].content = res.parsed.aiMessage
|
171
|
+
return newMessages
|
172
|
+
})
|
173
|
+
setIsThinking(false)
|
174
|
+
} catch (error) {
|
175
|
+
console.error(error)
|
176
|
+
// Remove the last message
|
177
|
+
setMessages((prev) => {
|
178
|
+
const newMessages = [...prev]
|
179
|
+
newMessages.pop()
|
180
|
+
return newMessages
|
181
|
+
})
|
182
|
+
setIsThinking(false)
|
183
|
+
}
|
171
184
|
}
|
172
185
|
|
173
186
|
const handleSubmit = async () => {
|
@@ -9,14 +9,15 @@ type TInteractiveCreationInputs = {
|
|
9
9
|
|
10
10
|
export const publicInteractiveCreation = async (
|
11
11
|
inputs: TInteractiveCreationInputs,
|
12
|
-
|
13
|
-
purposeSlug: string
|
12
|
+
token: string,
|
13
|
+
purposeSlug: string,
|
14
|
+
publicRequest: boolean = true
|
14
15
|
): Promise<any | null> => {
|
15
16
|
try {
|
16
17
|
const response = await axios.post(
|
17
|
-
`${RIGOBOT_HOST}/v1/prompting
|
18
|
-
|
19
|
-
}/`,
|
18
|
+
`${RIGOBOT_HOST}/v1/prompting${
|
19
|
+
publicRequest ? "/public" : ""
|
20
|
+
}/completion/${DEV_MODE ? "39" : "390"}/`,
|
20
21
|
{
|
21
22
|
inputs: inputs,
|
22
23
|
include_purpose_objective: true,
|
@@ -26,7 +27,7 @@ export const publicInteractiveCreation = async (
|
|
26
27
|
{
|
27
28
|
headers: {
|
28
29
|
"Content-Type": "application/json",
|
29
|
-
Authorization: `Token ${
|
30
|
+
Authorization: `Token ${token}`,
|
30
31
|
},
|
31
32
|
}
|
32
33
|
)
|