@studious-lms/server 1.14.0 → 1.16.0
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/dist/lib/inferDocumentFormat.d.ts +10 -0
- package/dist/lib/inferDocumentFormat.d.ts.map +1 -0
- package/dist/lib/inferDocumentFormat.js +48 -0
- package/dist/lib/inferDocumentFormat.js.map +1 -0
- package/dist/models/announcement.d.ts +45 -45
- package/dist/models/assignment.d.ts +75 -75
- package/dist/models/class.d.ts +13 -13
- package/dist/models/comment.d.ts +6 -6
- package/dist/models/conversation.d.ts +23 -23
- package/dist/models/event.d.ts +18 -18
- package/dist/models/file.d.ts +9 -9
- package/dist/models/labChat.d.ts +4 -4
- package/dist/models/message.d.ts +13 -13
- package/dist/models/newtonChat.d.ts +3 -3
- package/dist/models/notification.d.ts +4 -4
- package/dist/models/worksheet.d.ts +121 -121
- package/dist/pipelines/aiLabChat.d.ts +7 -1
- package/dist/pipelines/aiLabChat.d.ts.map +1 -1
- package/dist/pipelines/aiLabChat.js +145 -67
- package/dist/pipelines/aiLabChat.js.map +1 -1
- package/dist/pipelines/aiLabChatContract.d.ts +34 -195
- package/dist/pipelines/aiLabChatContract.d.ts.map +1 -1
- package/dist/pipelines/aiLabChatContract.js +9 -19
- package/dist/pipelines/aiLabChatContract.js.map +1 -1
- package/dist/pipelines/gradeWorksheet.d.ts +6 -6
- package/dist/pipelines/gradeWorksheet.d.ts.map +1 -1
- package/dist/pipelines/gradeWorksheet.js +75 -36
- package/dist/pipelines/gradeWorksheet.js.map +1 -1
- package/dist/pipelines/labChatPrompt.d.ts +8 -3
- package/dist/pipelines/labChatPrompt.d.ts.map +1 -1
- package/dist/pipelines/labChatPrompt.js +49 -14
- package/dist/pipelines/labChatPrompt.js.map +1 -1
- package/dist/pipelines/pdfToWorksheet.d.ts +1 -1
- package/dist/routers/_app.d.ts +524 -516
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/announcement.d.ts +40 -40
- package/dist/routers/assignment.d.ts +121 -121
- package/dist/routers/class.d.ts +8 -8
- package/dist/routers/comment.d.ts +5 -5
- package/dist/routers/conversation.d.ts +6 -6
- package/dist/routers/discussion.d.ts +3 -3
- package/dist/routers/embedding.d.ts +6 -2
- package/dist/routers/embedding.d.ts.map +1 -1
- package/dist/routers/embedding.js +44 -36
- package/dist/routers/embedding.js.map +1 -1
- package/dist/routers/event.d.ts +18 -18
- package/dist/routers/file.d.ts +2 -2
- package/dist/routers/labChat.d.ts +3 -3
- package/dist/routers/notifications.d.ts +4 -4
- package/dist/routers/search.d.ts +2 -2
- package/dist/routers/worksheet.d.ts +44 -44
- package/dist/routes/aiStream.d.ts.map +1 -1
- package/dist/routes/aiStream.js +41 -11
- package/dist/routes/aiStream.js.map +1 -1
- package/dist/seedDatabase.d.ts +1 -1
- package/dist/services/aiChatStream.d.ts +18 -0
- package/dist/services/aiChatStream.d.ts.map +1 -1
- package/dist/services/aiChatStream.js +81 -11
- package/dist/services/aiChatStream.js.map +1 -1
- package/dist/services/aiModifierTools.d.ts +0 -16
- package/dist/services/aiModifierTools.d.ts.map +1 -1
- package/dist/services/aiModifierTools.js +112 -3
- package/dist/services/aiModifierTools.js.map +1 -1
- package/dist/services/aiProposalTools.d.ts.map +1 -1
- package/dist/services/aiProposalTools.js +25 -25
- package/dist/services/aiProposalTools.js.map +1 -1
- package/dist/services/announcement.d.ts +34 -34
- package/dist/services/assignment.d.ts +111 -111
- package/dist/services/assignment.d.ts.map +1 -1
- package/dist/services/assignment.js +4 -2
- package/dist/services/assignment.js.map +1 -1
- package/dist/services/class.d.ts +6 -6
- package/dist/services/class.d.ts.map +1 -1
- package/dist/services/class.js +7 -3
- package/dist/services/class.js.map +1 -1
- package/dist/services/comment.d.ts +5 -5
- package/dist/services/conversation.d.ts +6 -6
- package/dist/services/discussion.d.ts.map +1 -1
- package/dist/services/discussion.js +9 -2
- package/dist/services/discussion.js.map +1 -1
- package/dist/services/embedding.d.ts +19 -1
- package/dist/services/embedding.d.ts.map +1 -1
- package/dist/services/embedding.js +154 -8
- package/dist/services/embedding.js.map +1 -1
- package/dist/services/event.d.ts +18 -18
- package/dist/services/file.d.ts +4 -4
- package/dist/services/folder.d.ts.map +1 -1
- package/dist/services/folder.js +32 -2
- package/dist/services/folder.js.map +1 -1
- package/dist/services/labChat.d.ts +3 -3
- package/dist/services/notification.d.ts +4 -4
- package/dist/services/openaiDocumentGen.d.ts +25 -0
- package/dist/services/openaiDocumentGen.d.ts.map +1 -0
- package/dist/services/openaiDocumentGen.js +195 -0
- package/dist/services/openaiDocumentGen.js.map +1 -0
- package/dist/services/search.d.ts +1 -1
- package/dist/services/search.d.ts.map +1 -1
- package/dist/services/search.js +27 -2
- package/dist/services/search.js.map +1 -1
- package/dist/services/worksheet.d.ts +66 -49
- package/dist/services/worksheet.d.ts.map +1 -1
- package/dist/services/worksheet.js +48 -3
- package/dist/services/worksheet.js.map +1 -1
- package/dist/workers/processors/embedContent.d.ts.map +1 -1
- package/dist/workers/processors/embedContent.js +16 -25
- package/dist/workers/processors/embedContent.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20260610140000_expand_embedding_source_types/migration.sql +4 -0
- package/prisma/schema.prisma +3 -0
- package/src/lib/inferDocumentFormat.ts +58 -0
- package/src/pipelines/aiLabChat.ts +185 -74
- package/src/pipelines/aiLabChatContract.ts +7 -17
- package/src/pipelines/gradeWorksheet.ts +95 -38
- package/src/pipelines/labChatPrompt.ts +61 -14
- package/src/routers/embedding.ts +44 -39
- package/src/routes/aiStream.ts +47 -9
- package/src/services/aiChatStream.ts +103 -8
- package/src/services/aiModifierTools.ts +154 -1
- package/src/services/aiProposalTools.ts +26 -25
- package/src/services/assignment.ts +3 -0
- package/src/services/class.ts +7 -1
- package/src/services/discussion.ts +13 -0
- package/src/services/embedding.ts +167 -6
- package/src/services/folder.ts +31 -0
- package/src/services/openaiDocumentGen.ts +237 -0
- package/src/services/search.ts +25 -1
- package/src/services/worksheet.ts +68 -1
- package/src/workers/processors/embedContent.ts +18 -22
- package/tests/unit/lib/inferDocumentFormat.test.ts +33 -0
|
@@ -9,12 +9,12 @@ export declare const worksheetQuestionSchema: z.ZodObject<{
|
|
|
9
9
|
isCorrect: z.ZodBoolean;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
id: string;
|
|
12
|
-
isCorrect: boolean;
|
|
13
12
|
text: string;
|
|
13
|
+
isCorrect: boolean;
|
|
14
14
|
}, {
|
|
15
15
|
id: string;
|
|
16
|
-
isCorrect: boolean;
|
|
17
16
|
text: string;
|
|
17
|
+
isCorrect: boolean;
|
|
18
18
|
}>, "many">>>;
|
|
19
19
|
markScheme: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
20
|
id: z.ZodString;
|
|
@@ -35,27 +35,27 @@ export declare const worksheetQuestionSchema: z.ZodObject<{
|
|
|
35
35
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
36
36
|
options: {
|
|
37
37
|
id: string;
|
|
38
|
-
isCorrect: boolean;
|
|
39
38
|
text: string;
|
|
39
|
+
isCorrect: boolean;
|
|
40
40
|
}[];
|
|
41
41
|
markScheme: {
|
|
42
42
|
id: string;
|
|
43
43
|
description: string;
|
|
44
44
|
points: number;
|
|
45
45
|
}[];
|
|
46
|
-
|
|
46
|
+
points: number;
|
|
47
47
|
question: string;
|
|
48
|
+
order: number;
|
|
48
49
|
answer: string;
|
|
49
|
-
points: number;
|
|
50
50
|
}, {
|
|
51
51
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
52
|
-
order: number;
|
|
53
52
|
question: string;
|
|
53
|
+
order: number;
|
|
54
54
|
answer: string;
|
|
55
55
|
options?: {
|
|
56
56
|
id: string;
|
|
57
|
-
isCorrect: boolean;
|
|
58
57
|
text: string;
|
|
58
|
+
isCorrect: boolean;
|
|
59
59
|
}[] | undefined;
|
|
60
60
|
markScheme?: {
|
|
61
61
|
id: string;
|
|
@@ -76,12 +76,12 @@ export declare const worksheetToCreateSchema: z.ZodObject<{
|
|
|
76
76
|
isCorrect: z.ZodBoolean;
|
|
77
77
|
}, "strip", z.ZodTypeAny, {
|
|
78
78
|
id: string;
|
|
79
|
-
isCorrect: boolean;
|
|
80
79
|
text: string;
|
|
80
|
+
isCorrect: boolean;
|
|
81
81
|
}, {
|
|
82
82
|
id: string;
|
|
83
|
-
isCorrect: boolean;
|
|
84
83
|
text: string;
|
|
84
|
+
isCorrect: boolean;
|
|
85
85
|
}>, "many">>>;
|
|
86
86
|
markScheme: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
87
|
id: z.ZodString;
|
|
@@ -102,27 +102,27 @@ export declare const worksheetToCreateSchema: z.ZodObject<{
|
|
|
102
102
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
103
103
|
options: {
|
|
104
104
|
id: string;
|
|
105
|
-
isCorrect: boolean;
|
|
106
105
|
text: string;
|
|
106
|
+
isCorrect: boolean;
|
|
107
107
|
}[];
|
|
108
108
|
markScheme: {
|
|
109
109
|
id: string;
|
|
110
110
|
description: string;
|
|
111
111
|
points: number;
|
|
112
112
|
}[];
|
|
113
|
-
|
|
113
|
+
points: number;
|
|
114
114
|
question: string;
|
|
115
|
+
order: number;
|
|
115
116
|
answer: string;
|
|
116
|
-
points: number;
|
|
117
117
|
}, {
|
|
118
118
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
119
|
-
order: number;
|
|
120
119
|
question: string;
|
|
120
|
+
order: number;
|
|
121
121
|
answer: string;
|
|
122
122
|
options?: {
|
|
123
123
|
id: string;
|
|
124
|
-
isCorrect: boolean;
|
|
125
124
|
text: string;
|
|
125
|
+
isCorrect: boolean;
|
|
126
126
|
}[] | undefined;
|
|
127
127
|
markScheme?: {
|
|
128
128
|
id: string;
|
|
@@ -137,30 +137,30 @@ export declare const worksheetToCreateSchema: z.ZodObject<{
|
|
|
137
137
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
138
138
|
options: {
|
|
139
139
|
id: string;
|
|
140
|
-
isCorrect: boolean;
|
|
141
140
|
text: string;
|
|
141
|
+
isCorrect: boolean;
|
|
142
142
|
}[];
|
|
143
143
|
markScheme: {
|
|
144
144
|
id: string;
|
|
145
145
|
description: string;
|
|
146
146
|
points: number;
|
|
147
147
|
}[];
|
|
148
|
-
|
|
148
|
+
points: number;
|
|
149
149
|
question: string;
|
|
150
|
+
order: number;
|
|
150
151
|
answer: string;
|
|
151
|
-
points: number;
|
|
152
152
|
}[];
|
|
153
153
|
}, {
|
|
154
154
|
title: string;
|
|
155
155
|
questions: {
|
|
156
156
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
157
|
-
order: number;
|
|
158
157
|
question: string;
|
|
158
|
+
order: number;
|
|
159
159
|
answer: string;
|
|
160
160
|
options?: {
|
|
161
161
|
id: string;
|
|
162
|
-
isCorrect: boolean;
|
|
163
162
|
text: string;
|
|
163
|
+
isCorrect: boolean;
|
|
164
164
|
}[] | undefined;
|
|
165
165
|
markScheme?: {
|
|
166
166
|
id: string;
|
|
@@ -202,214 +202,53 @@ export declare const assignmentToCreateSchema: z.ZodObject<{
|
|
|
202
202
|
id: string;
|
|
203
203
|
}>, "many">;
|
|
204
204
|
}, "strip", z.ZodTypeAny, {
|
|
205
|
-
type: "HOMEWORK" | "QUIZ" | "TEST" | "PROJECT" | "ESSAY" | "
|
|
205
|
+
type: "DISCUSSION" | "HOMEWORK" | "QUIZ" | "TEST" | "PROJECT" | "ESSAY" | "PRESENTATION" | "LAB" | "OTHER";
|
|
206
206
|
title: string;
|
|
207
207
|
dueDate: string;
|
|
208
208
|
maxGrade: number;
|
|
209
|
+
attachments: {
|
|
210
|
+
id: string;
|
|
211
|
+
}[];
|
|
209
212
|
instructions: string;
|
|
210
213
|
acceptFiles: boolean;
|
|
211
214
|
acceptExtendedResponse: boolean;
|
|
212
215
|
acceptWorksheet: boolean;
|
|
213
|
-
attachments: {
|
|
214
|
-
id: string;
|
|
215
|
-
}[];
|
|
216
216
|
worksheetIds: string[];
|
|
217
217
|
studentIds: string[];
|
|
218
218
|
sectionId?: string | null | undefined;
|
|
219
219
|
markSchemeId?: string | null | undefined;
|
|
220
220
|
gradingBoundaryId?: string | null | undefined;
|
|
221
221
|
}, {
|
|
222
|
-
type: "HOMEWORK" | "QUIZ" | "TEST" | "PROJECT" | "ESSAY" | "
|
|
222
|
+
type: "DISCUSSION" | "HOMEWORK" | "QUIZ" | "TEST" | "PROJECT" | "ESSAY" | "PRESENTATION" | "LAB" | "OTHER";
|
|
223
223
|
title: string;
|
|
224
224
|
dueDate: string;
|
|
225
225
|
maxGrade: number;
|
|
226
|
+
attachments: {
|
|
227
|
+
id: string;
|
|
228
|
+
}[];
|
|
226
229
|
instructions: string;
|
|
227
230
|
acceptFiles: boolean;
|
|
228
231
|
acceptExtendedResponse: boolean;
|
|
229
232
|
acceptWorksheet: boolean;
|
|
230
|
-
attachments: {
|
|
231
|
-
id: string;
|
|
232
|
-
}[];
|
|
233
233
|
worksheetIds: string[];
|
|
234
234
|
studentIds: string[];
|
|
235
235
|
sectionId?: string | null | undefined;
|
|
236
236
|
markSchemeId?: string | null | undefined;
|
|
237
237
|
gradingBoundaryId?: string | null | undefined;
|
|
238
238
|
}>;
|
|
239
|
-
export declare const
|
|
240
|
-
format: z.ZodNumber;
|
|
241
|
-
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
242
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
243
|
-
fontSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
244
|
-
lineHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
245
|
-
paragraphSpacing: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
246
|
-
indentWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
247
|
-
paddingX: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
248
|
-
paddingY: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
249
|
-
font: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
250
|
-
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
251
|
-
background: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
|
-
align: z.ZodOptional<z.ZodNullable<z.ZodEnum<["left", "center", "right"]>>>;
|
|
253
|
-
}, "strip", z.ZodTypeAny, {
|
|
254
|
-
color?: string | null | undefined;
|
|
255
|
-
background?: string | null | undefined;
|
|
256
|
-
font?: number | null | undefined;
|
|
257
|
-
fontSize?: number | null | undefined;
|
|
258
|
-
lineHeight?: number | null | undefined;
|
|
259
|
-
paragraphSpacing?: number | null | undefined;
|
|
260
|
-
indentWidth?: number | null | undefined;
|
|
261
|
-
paddingX?: number | null | undefined;
|
|
262
|
-
paddingY?: number | null | undefined;
|
|
263
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
264
|
-
}, {
|
|
265
|
-
color?: string | null | undefined;
|
|
266
|
-
background?: string | null | undefined;
|
|
267
|
-
font?: number | null | undefined;
|
|
268
|
-
fontSize?: number | null | undefined;
|
|
269
|
-
lineHeight?: number | null | undefined;
|
|
270
|
-
paragraphSpacing?: number | null | undefined;
|
|
271
|
-
indentWidth?: number | null | undefined;
|
|
272
|
-
paddingX?: number | null | undefined;
|
|
273
|
-
paddingY?: number | null | undefined;
|
|
274
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
275
|
-
}>>>;
|
|
276
|
-
}, "strip", z.ZodTypeAny, {
|
|
277
|
-
content: string | string[];
|
|
278
|
-
format: number;
|
|
279
|
-
metadata?: {
|
|
280
|
-
color?: string | null | undefined;
|
|
281
|
-
background?: string | null | undefined;
|
|
282
|
-
font?: number | null | undefined;
|
|
283
|
-
fontSize?: number | null | undefined;
|
|
284
|
-
lineHeight?: number | null | undefined;
|
|
285
|
-
paragraphSpacing?: number | null | undefined;
|
|
286
|
-
indentWidth?: number | null | undefined;
|
|
287
|
-
paddingX?: number | null | undefined;
|
|
288
|
-
paddingY?: number | null | undefined;
|
|
289
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
290
|
-
} | null | undefined;
|
|
291
|
-
}, {
|
|
292
|
-
content: string | string[];
|
|
293
|
-
format: number;
|
|
294
|
-
metadata?: {
|
|
295
|
-
color?: string | null | undefined;
|
|
296
|
-
background?: string | null | undefined;
|
|
297
|
-
font?: number | null | undefined;
|
|
298
|
-
fontSize?: number | null | undefined;
|
|
299
|
-
lineHeight?: number | null | undefined;
|
|
300
|
-
paragraphSpacing?: number | null | undefined;
|
|
301
|
-
indentWidth?: number | null | undefined;
|
|
302
|
-
paddingX?: number | null | undefined;
|
|
303
|
-
paddingY?: number | null | undefined;
|
|
304
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
305
|
-
} | null | undefined;
|
|
306
|
-
}>;
|
|
239
|
+
export declare const documentFormatSchema: z.ZodEnum<["pdf", "docx", "doc", "xlsx", "pptx", "csv", "md", "html", "txt", "json", "xml", "tex", "png", "jpeg", "jpg", "gif", "zip", "tar", "py", "js", "ts", "css", "sh"]>;
|
|
307
240
|
export declare const docToCreateSchema: z.ZodObject<{
|
|
308
241
|
title: z.ZodString;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
312
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
313
|
-
fontSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
314
|
-
lineHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
315
|
-
paragraphSpacing: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
316
|
-
indentWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
317
|
-
paddingX: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
318
|
-
paddingY: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
319
|
-
font: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
320
|
-
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
321
|
-
background: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
|
-
align: z.ZodOptional<z.ZodNullable<z.ZodEnum<["left", "center", "right"]>>>;
|
|
323
|
-
}, "strip", z.ZodTypeAny, {
|
|
324
|
-
color?: string | null | undefined;
|
|
325
|
-
background?: string | null | undefined;
|
|
326
|
-
font?: number | null | undefined;
|
|
327
|
-
fontSize?: number | null | undefined;
|
|
328
|
-
lineHeight?: number | null | undefined;
|
|
329
|
-
paragraphSpacing?: number | null | undefined;
|
|
330
|
-
indentWidth?: number | null | undefined;
|
|
331
|
-
paddingX?: number | null | undefined;
|
|
332
|
-
paddingY?: number | null | undefined;
|
|
333
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
334
|
-
}, {
|
|
335
|
-
color?: string | null | undefined;
|
|
336
|
-
background?: string | null | undefined;
|
|
337
|
-
font?: number | null | undefined;
|
|
338
|
-
fontSize?: number | null | undefined;
|
|
339
|
-
lineHeight?: number | null | undefined;
|
|
340
|
-
paragraphSpacing?: number | null | undefined;
|
|
341
|
-
indentWidth?: number | null | undefined;
|
|
342
|
-
paddingX?: number | null | undefined;
|
|
343
|
-
paddingY?: number | null | undefined;
|
|
344
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
345
|
-
}>>>;
|
|
346
|
-
}, "strip", z.ZodTypeAny, {
|
|
347
|
-
content: string | string[];
|
|
348
|
-
format: number;
|
|
349
|
-
metadata?: {
|
|
350
|
-
color?: string | null | undefined;
|
|
351
|
-
background?: string | null | undefined;
|
|
352
|
-
font?: number | null | undefined;
|
|
353
|
-
fontSize?: number | null | undefined;
|
|
354
|
-
lineHeight?: number | null | undefined;
|
|
355
|
-
paragraphSpacing?: number | null | undefined;
|
|
356
|
-
indentWidth?: number | null | undefined;
|
|
357
|
-
paddingX?: number | null | undefined;
|
|
358
|
-
paddingY?: number | null | undefined;
|
|
359
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
360
|
-
} | null | undefined;
|
|
361
|
-
}, {
|
|
362
|
-
content: string | string[];
|
|
363
|
-
format: number;
|
|
364
|
-
metadata?: {
|
|
365
|
-
color?: string | null | undefined;
|
|
366
|
-
background?: string | null | undefined;
|
|
367
|
-
font?: number | null | undefined;
|
|
368
|
-
fontSize?: number | null | undefined;
|
|
369
|
-
lineHeight?: number | null | undefined;
|
|
370
|
-
paragraphSpacing?: number | null | undefined;
|
|
371
|
-
indentWidth?: number | null | undefined;
|
|
372
|
-
paddingX?: number | null | undefined;
|
|
373
|
-
paddingY?: number | null | undefined;
|
|
374
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
375
|
-
} | null | undefined;
|
|
376
|
-
}>, "many">;
|
|
242
|
+
content: z.ZodString;
|
|
243
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pdf", "docx", "doc", "xlsx", "pptx", "csv", "md", "html", "txt", "json", "xml", "tex", "png", "jpeg", "jpg", "gif", "zip", "tar", "py", "js", "ts", "css", "sh"]>>>;
|
|
377
244
|
}, "strip", z.ZodTypeAny, {
|
|
378
245
|
title: string;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
format: number;
|
|
382
|
-
metadata?: {
|
|
383
|
-
color?: string | null | undefined;
|
|
384
|
-
background?: string | null | undefined;
|
|
385
|
-
font?: number | null | undefined;
|
|
386
|
-
fontSize?: number | null | undefined;
|
|
387
|
-
lineHeight?: number | null | undefined;
|
|
388
|
-
paragraphSpacing?: number | null | undefined;
|
|
389
|
-
indentWidth?: number | null | undefined;
|
|
390
|
-
paddingX?: number | null | undefined;
|
|
391
|
-
paddingY?: number | null | undefined;
|
|
392
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
393
|
-
} | null | undefined;
|
|
394
|
-
}[];
|
|
246
|
+
content: string;
|
|
247
|
+
format: "jpg" | "jpeg" | "png" | "gif" | "html" | "pdf" | "docx" | "xlsx" | "pptx" | "md" | "txt" | "csv" | "doc" | "json" | "xml" | "tex" | "zip" | "tar" | "py" | "js" | "ts" | "css" | "sh";
|
|
395
248
|
}, {
|
|
396
249
|
title: string;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
format: number;
|
|
400
|
-
metadata?: {
|
|
401
|
-
color?: string | null | undefined;
|
|
402
|
-
background?: string | null | undefined;
|
|
403
|
-
font?: number | null | undefined;
|
|
404
|
-
fontSize?: number | null | undefined;
|
|
405
|
-
lineHeight?: number | null | undefined;
|
|
406
|
-
paragraphSpacing?: number | null | undefined;
|
|
407
|
-
indentWidth?: number | null | undefined;
|
|
408
|
-
paddingX?: number | null | undefined;
|
|
409
|
-
paddingY?: number | null | undefined;
|
|
410
|
-
align?: "left" | "center" | "right" | null | undefined;
|
|
411
|
-
} | null | undefined;
|
|
412
|
-
}[];
|
|
250
|
+
content: string;
|
|
251
|
+
format?: "jpg" | "jpeg" | "png" | "gif" | "html" | "pdf" | "docx" | "xlsx" | "pptx" | "md" | "txt" | "csv" | "doc" | "json" | "xml" | "tex" | "zip" | "tar" | "py" | "js" | "ts" | "css" | "sh" | undefined;
|
|
413
252
|
}>;
|
|
414
253
|
export type WorksheetToCreate = z.infer<typeof worksheetToCreateSchema>;
|
|
415
254
|
export type SectionToCreate = z.infer<typeof sectionToCreateSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiLabChatContract.d.ts","sourceRoot":"/","sources":["pipelines/aiLabChatContract.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBlC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGlC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnC,CAAC;AAEH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"aiLabChatContract.d.ts","sourceRoot":"/","sources":["pipelines/aiLabChatContract.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBlC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGlC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnC,CAAC;AAEH,eAAO,MAAM,oBAAoB,+KAI/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="014b6af6-35ab-5e0f-8113-8bfd1d48964d")}catch(e){}}();
|
|
3
3
|
import z from "zod";
|
|
4
4
|
export const worksheetQuestionSchema = z.object({
|
|
5
5
|
type: z.enum(["MULTIPLE_CHOICE", "TRUE_FALSE", "SHORT_ANSWER", "LONG_ANSWER", "MATH_EXPRESSION", "ESSAY"]),
|
|
@@ -44,25 +44,15 @@ export const assignmentToCreateSchema = z.object({
|
|
|
44
44
|
id: z.string(),
|
|
45
45
|
})),
|
|
46
46
|
});
|
|
47
|
-
export const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
lineHeight: z.number().min(0.6).nullable().optional(),
|
|
53
|
-
paragraphSpacing: z.number().min(0).nullable().optional(),
|
|
54
|
-
indentWidth: z.number().min(0).nullable().optional(),
|
|
55
|
-
paddingX: z.number().min(0).nullable().optional(),
|
|
56
|
-
paddingY: z.number().min(0).nullable().optional(),
|
|
57
|
-
font: z.number().int().min(0).max(5).nullable().optional(),
|
|
58
|
-
color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
59
|
-
background: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
60
|
-
align: z.enum(["left", "center", "right"]).nullable().optional(),
|
|
61
|
-
}).nullable().optional(),
|
|
62
|
-
});
|
|
47
|
+
export const documentFormatSchema = z.enum([
|
|
48
|
+
'pdf', 'docx', 'doc', 'xlsx', 'pptx', 'csv', 'md', 'html', 'txt', 'json',
|
|
49
|
+
'xml', 'tex', 'png', 'jpeg', 'jpg', 'gif', 'zip', 'tar', 'py', 'js', 'ts',
|
|
50
|
+
'css', 'sh',
|
|
51
|
+
]);
|
|
63
52
|
export const docToCreateSchema = z.object({
|
|
64
53
|
title: z.string(),
|
|
65
|
-
|
|
54
|
+
content: z.string().min(1),
|
|
55
|
+
format: documentFormatSchema.optional().default('pdf'),
|
|
66
56
|
});
|
|
67
57
|
//# sourceMappingURL=aiLabChatContract.js.map
|
|
68
|
-
//# debugId=
|
|
58
|
+
//# debugId=014b6af6-35ab-5e0f-8113-8bfd1d48964d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiLabChatContract.js","sources":["pipelines/aiLabChatContract.ts"],"sourceRoot":"/","sourcesContent":["import z from \"zod\";\n\nexport const worksheetQuestionSchema = z.object({\n type: z.enum([\"MULTIPLE_CHOICE\", \"TRUE_FALSE\", \"SHORT_ANSWER\", \"LONG_ANSWER\", \"MATH_EXPRESSION\", \"ESSAY\"]),\n question: z.string(),\n answer: z.string(),\n options: z.array(z.object({\n id: z.string(),\n text: z.string(),\n isCorrect: z.boolean(),\n })).optional().default([]),\n markScheme: z.array(z.object({\n id: z.string(),\n points: z.number(),\n description: z.string(),\n })).optional().default([]),\n points: z.number().optional().default(0),\n order: z.number(),\n});\n\nexport const worksheetToCreateSchema = z.object({\n title: z.string(),\n questions: z.array(worksheetQuestionSchema),\n});\n\nexport const sectionToCreateSchema = z.object({\n name: z.string(),\n color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n});\n\nexport const assignmentToCreateSchema = z.object({\n title: z.string(),\n instructions: z.string(),\n dueDate: z.string().datetime(),\n acceptFiles: z.boolean(),\n acceptExtendedResponse: z.boolean(),\n acceptWorksheet: z.boolean(),\n maxGrade: z.number(),\n gradingBoundaryId: z.string().nullable().optional(),\n markSchemeId: z.string().nullable().optional(),\n worksheetIds: z.array(z.string()),\n studentIds: z.array(z.string()),\n sectionId: z.string().nullable().optional(),\n type: z.enum([\"HOMEWORK\", \"QUIZ\", \"TEST\", \"PROJECT\", \"ESSAY\", \"DISCUSSION\", \"PRESENTATION\", \"LAB\", \"OTHER\"]),\n attachments: z.array(z.object({\n id: z.string(),\n })),\n});\n\nexport const
|
|
1
|
+
{"version":3,"file":"aiLabChatContract.js","sources":["pipelines/aiLabChatContract.ts"],"sourceRoot":"/","sourcesContent":["import z from \"zod\";\n\nexport const worksheetQuestionSchema = z.object({\n type: z.enum([\"MULTIPLE_CHOICE\", \"TRUE_FALSE\", \"SHORT_ANSWER\", \"LONG_ANSWER\", \"MATH_EXPRESSION\", \"ESSAY\"]),\n question: z.string(),\n answer: z.string(),\n options: z.array(z.object({\n id: z.string(),\n text: z.string(),\n isCorrect: z.boolean(),\n })).optional().default([]),\n markScheme: z.array(z.object({\n id: z.string(),\n points: z.number(),\n description: z.string(),\n })).optional().default([]),\n points: z.number().optional().default(0),\n order: z.number(),\n});\n\nexport const worksheetToCreateSchema = z.object({\n title: z.string(),\n questions: z.array(worksheetQuestionSchema),\n});\n\nexport const sectionToCreateSchema = z.object({\n name: z.string(),\n color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),\n});\n\nexport const assignmentToCreateSchema = z.object({\n title: z.string(),\n instructions: z.string(),\n dueDate: z.string().datetime(),\n acceptFiles: z.boolean(),\n acceptExtendedResponse: z.boolean(),\n acceptWorksheet: z.boolean(),\n maxGrade: z.number(),\n gradingBoundaryId: z.string().nullable().optional(),\n markSchemeId: z.string().nullable().optional(),\n worksheetIds: z.array(z.string()),\n studentIds: z.array(z.string()),\n sectionId: z.string().nullable().optional(),\n type: z.enum([\"HOMEWORK\", \"QUIZ\", \"TEST\", \"PROJECT\", \"ESSAY\", \"DISCUSSION\", \"PRESENTATION\", \"LAB\", \"OTHER\"]),\n attachments: z.array(z.object({\n id: z.string(),\n })),\n});\n\nexport const documentFormatSchema = z.enum([\n 'pdf', 'docx', 'doc', 'xlsx', 'pptx', 'csv', 'md', 'html', 'txt', 'json',\n 'xml', 'tex', 'png', 'jpeg', 'jpg', 'gif', 'zip', 'tar', 'py', 'js', 'ts',\n 'css', 'sh',\n]);\n\nexport const docToCreateSchema = z.object({\n title: z.string(),\n content: z.string().min(1),\n format: documentFormatSchema.optional().default('pdf'),\n});\n\nexport type WorksheetToCreate = z.infer<typeof worksheetToCreateSchema>;\nexport type SectionToCreate = z.infer<typeof sectionToCreateSchema>;\nexport type AssignmentToCreate = z.infer<typeof assignmentToCreateSchema>;\nexport type DocToCreate = z.infer<typeof docToCreateSchema>;\n"],"names":[],"mappings":"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","debug_id":"014b6af6-35ab-5e0f-8113-8bfd1d48964d"}
|
|
@@ -5,14 +5,14 @@ export declare const cancelGradePipeline: (worksheetResponseId: string, workshee
|
|
|
5
5
|
createdAt: Date;
|
|
6
6
|
updatedAt: Date | null;
|
|
7
7
|
feedback: string | null;
|
|
8
|
-
studentId: string;
|
|
9
8
|
runJobId: string | null;
|
|
10
|
-
points: number;
|
|
11
9
|
response: string;
|
|
12
10
|
isCorrect: boolean;
|
|
13
11
|
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
14
|
-
|
|
12
|
+
points: number;
|
|
13
|
+
studentId: string;
|
|
15
14
|
questionId: string;
|
|
15
|
+
studentWorksheetResponseId: string | null;
|
|
16
16
|
}>;
|
|
17
17
|
export declare const regradeWorksheetPipeline: (worksheetResponseId: string, worksheetQuestionProgressId: string) => Promise<{
|
|
18
18
|
status: import(".prisma/client").$Enums.JobStatus | null;
|
|
@@ -20,13 +20,13 @@ export declare const regradeWorksheetPipeline: (worksheetResponseId: string, wor
|
|
|
20
20
|
createdAt: Date;
|
|
21
21
|
updatedAt: Date | null;
|
|
22
22
|
feedback: string | null;
|
|
23
|
-
studentId: string;
|
|
24
23
|
runJobId: string | null;
|
|
25
|
-
points: number;
|
|
26
24
|
response: string;
|
|
27
25
|
isCorrect: boolean;
|
|
28
26
|
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
29
|
-
|
|
27
|
+
points: number;
|
|
28
|
+
studentId: string;
|
|
30
29
|
questionId: string;
|
|
30
|
+
studentWorksheetResponseId: string | null;
|
|
31
31
|
} | null>;
|
|
32
32
|
//# sourceMappingURL=gradeWorksheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradeWorksheet.d.ts","sourceRoot":"/","sources":["pipelines/gradeWorksheet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gradeWorksheet.d.ts","sourceRoot":"/","sources":["pipelines/gradeWorksheet.ts"],"names":[],"mappings":"AAkPA,eAAO,MAAM,sBAAsB,GAAU,qBAAqB,MAAM,kBAmGvE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,qBAAqB,MAAM,EAAE,6BAA6B,MAAM;;;;;;;;;;;;;;EAyBzG,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,qBAAqB,MAAM,EAAE,6BAA6B,MAAM;;;;;;;;;;;;;;SAqE9G,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Grades questions via inference API, broadcasts status via Pusher (pending/completed/failed/cancelled).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
6
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="41d0c7b5-4d82-5d9a-b811-3ff0fa9e3cd8")}catch(e){}}();
|
|
7
7
|
import { JobStatus, WorksheetQuestionType } from "@prisma/client";
|
|
8
8
|
import { prisma } from "../lib/prisma.js";
|
|
9
9
|
import { logger } from "../utils/logger.js";
|
|
@@ -19,6 +19,52 @@ const removeAllPreviousAIComments = async (worksheetQuestionProgressId) => {
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
+
const gradingResponseSchema = z.object({
|
|
23
|
+
isCorrect: z.boolean(),
|
|
24
|
+
points: z.number(),
|
|
25
|
+
markschemeState: z.array(z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
correct: z.boolean(),
|
|
28
|
+
})),
|
|
29
|
+
comments: z.array(z.string()),
|
|
30
|
+
annotations: z.array(z.object({
|
|
31
|
+
quote: z.string().describe('An exact substring from the student response that is relevant to this criterion.'),
|
|
32
|
+
markSchemeId: z.string().describe('The id of the mark scheme criterion this quote relates to.'),
|
|
33
|
+
criterion: z.string().describe('Short label describing what this mark scheme criterion evaluates.'),
|
|
34
|
+
met: z.boolean().describe('Whether the quoted text satisfies this criterion.'),
|
|
35
|
+
})).describe('Highlight specific parts of the student response and map each to a mark scheme criterion.'),
|
|
36
|
+
});
|
|
37
|
+
function buildGradingPrompt(question, responseText) {
|
|
38
|
+
const markSchemeItems = Array.isArray(question.markScheme) ? question.markScheme : [];
|
|
39
|
+
const markSchemeBlock = markSchemeItems.length > 0
|
|
40
|
+
? markSchemeItems.map((item, i) => ` ${i + 1}. [id="${item.id}", ${item.points} pts] ${item.description || item.text || `Criterion ${i + 1}`}`).join('\n')
|
|
41
|
+
: ' No mark scheme provided — grade based on correctness and completeness.';
|
|
42
|
+
const maxPoints = question.points || markSchemeItems.reduce((sum, item) => sum + (item.points || 0), 0);
|
|
43
|
+
return `Grade the following student response.
|
|
44
|
+
|
|
45
|
+
Question type: ${question.type}
|
|
46
|
+
Maximum points: ${maxPoints}
|
|
47
|
+
|
|
48
|
+
QUESTION:
|
|
49
|
+
${question.question}
|
|
50
|
+
|
|
51
|
+
CORRECT ANSWER:
|
|
52
|
+
${question.answer || 'No answer key provided.'}
|
|
53
|
+
|
|
54
|
+
MARK SCHEME:
|
|
55
|
+
${markSchemeBlock}
|
|
56
|
+
|
|
57
|
+
STUDENT RESPONSE:
|
|
58
|
+
${responseText}
|
|
59
|
+
|
|
60
|
+
INSTRUCTIONS:
|
|
61
|
+
- Evaluate the student response against each mark scheme criterion.
|
|
62
|
+
- Total points must not exceed ${maxPoints}.
|
|
63
|
+
- For each criterion, find the exact substring in the student's response that is relevant (the "quote" field). Copy the text verbatim — do not paraphrase.
|
|
64
|
+
- If no part of the response addresses a criterion, still include an annotation with an empty quote and met=false.
|
|
65
|
+
- Provide constructive feedback comments.
|
|
66
|
+
- Mark isCorrect=true only if the student earned full or near-full marks.`;
|
|
67
|
+
}
|
|
22
68
|
const gradeWorksheetQuestion = async (worksheetResponseId, worksheetQuestionProgressId) => {
|
|
23
69
|
await removeAllPreviousAIComments(worksheetQuestionProgressId);
|
|
24
70
|
const worksheetResponse = await prisma.studentWorksheetResponse.findUnique({
|
|
@@ -73,35 +119,9 @@ const gradeWorksheetQuestion = async (worksheetResponseId, worksheetQuestionProg
|
|
|
73
119
|
});
|
|
74
120
|
return updatedProgress;
|
|
75
121
|
}
|
|
76
|
-
const comments = studentQuestionProgress.comments;
|
|
77
122
|
try {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
Question: ${question.question}
|
|
81
|
-
Response: ${responseText}
|
|
82
|
-
|
|
83
|
-
Comments: ${comments.map((comment) => comment.content).join('\n')}
|
|
84
|
-
Mark Scheme: ${JSON.stringify(question.markScheme)}
|
|
85
|
-
|
|
86
|
-
Justify your reasoning by including comment(s) and mark the question please.
|
|
87
|
-
Return ONLY JSON in the following format (fill in the values as per the question):
|
|
88
|
-
{
|
|
89
|
-
"isCorrect": <boolean>,
|
|
90
|
-
"points": <number>,
|
|
91
|
-
"markschemeState": [
|
|
92
|
-
{ "id": <string>, "correct": <boolean> }
|
|
93
|
-
],
|
|
94
|
-
"comments": [<string>, ...]
|
|
95
|
-
}
|
|
96
|
-
`, z.object({
|
|
97
|
-
isCorrect: z.boolean(),
|
|
98
|
-
points: z.number(),
|
|
99
|
-
markschemeState: z.array(z.object({
|
|
100
|
-
id: z.string(),
|
|
101
|
-
correct: z.boolean(),
|
|
102
|
-
})), // @note: this has to be converted to [id: string]: correct boolean
|
|
103
|
-
comments: z.array(z.string()),
|
|
104
|
-
}), {
|
|
123
|
+
const prompt = buildGradingPrompt(question, responseText);
|
|
124
|
+
const apiResponse = await inference(prompt, gradingResponseSchema, {
|
|
105
125
|
reason: 'worksheet_autograde',
|
|
106
126
|
metadata: {
|
|
107
127
|
worksheetResponseId: worksheetResponse.id,
|
|
@@ -112,6 +132,17 @@ const gradeWorksheetQuestion = async (worksheetResponseId, worksheetQuestionProg
|
|
|
112
132
|
logger.error('Failed to grade worksheet response', { error });
|
|
113
133
|
throw error;
|
|
114
134
|
});
|
|
135
|
+
const maxPoints = question.points || 0;
|
|
136
|
+
const clampedPoints = Math.max(0, Math.min(Math.round(apiResponse.points), maxPoints));
|
|
137
|
+
const validMarkSchemeIds = new Set((Array.isArray(question.markScheme) ? question.markScheme : []).map(item => item.id));
|
|
138
|
+
const validatedMarkschemeState = apiResponse.markschemeState
|
|
139
|
+
.filter(item => validMarkSchemeIds.has(item.id))
|
|
140
|
+
.reduce((acc, curr) => {
|
|
141
|
+
acc["item-" + curr.id] = curr.correct;
|
|
142
|
+
return acc;
|
|
143
|
+
}, {});
|
|
144
|
+
const annotations = apiResponse.annotations
|
|
145
|
+
.filter(a => a.quote.length === 0 || responseText.includes(a.quote));
|
|
115
146
|
const updatedStudentQuestionProgress = await prisma.studentQuestionProgress.update({
|
|
116
147
|
where: { id: studentQuestionProgress.id, status: {
|
|
117
148
|
not: {
|
|
@@ -121,11 +152,11 @@ const gradeWorksheetQuestion = async (worksheetResponseId, worksheetQuestionProg
|
|
|
121
152
|
data: {
|
|
122
153
|
status: JobStatus.COMPLETED,
|
|
123
154
|
isCorrect: apiResponse.isCorrect,
|
|
124
|
-
points:
|
|
125
|
-
markschemeState:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
155
|
+
points: clampedPoints,
|
|
156
|
+
markschemeState: {
|
|
157
|
+
...validatedMarkschemeState,
|
|
158
|
+
_annotations: annotations,
|
|
159
|
+
},
|
|
129
160
|
comments: {
|
|
130
161
|
create: apiResponse.comments.map((commentContent) => ({
|
|
131
162
|
content: commentContent,
|
|
@@ -245,7 +276,15 @@ export const gradeWorksheetPipeline = async (worksheetResponseId) => {
|
|
|
245
276
|
if (count === 0) {
|
|
246
277
|
continue;
|
|
247
278
|
}
|
|
248
|
-
|
|
279
|
+
try {
|
|
280
|
+
await gradeWorksheetQuestion(worksheetResponseId, response.id);
|
|
281
|
+
}
|
|
282
|
+
catch (questionError) {
|
|
283
|
+
logger.error('Failed to grade individual question, continuing with remaining questions', {
|
|
284
|
+
questionId: response.questionId,
|
|
285
|
+
error: questionError,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
249
288
|
}
|
|
250
289
|
;
|
|
251
290
|
};
|
|
@@ -337,4 +376,4 @@ export const regradeWorksheetPipeline = async (worksheetResponseId, worksheetQue
|
|
|
337
376
|
}
|
|
338
377
|
};
|
|
339
378
|
//# sourceMappingURL=gradeWorksheet.js.map
|
|
340
|
-
//# debugId=
|
|
379
|
+
//# debugId=41d0c7b5-4d82-5d9a-b811-3ff0fa9e3cd8
|