@thanh01.pmt/interactive-quiz-kit 1.0.64 → 1.0.66
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/ai.cjs +2 -1
- package/dist/ai.d.cts +45 -0
- package/dist/ai.d.ts +45 -0
- package/dist/ai.mjs +2 -1
- package/dist/authoring.cjs +102 -188
- package/dist/authoring.d.cts +1 -1
- package/dist/authoring.d.ts +1 -1
- package/dist/authoring.mjs +102 -188
- package/dist/react-ui.cjs +102 -190
- package/dist/react-ui.d.cts +1 -1
- package/dist/react-ui.d.ts +1 -1
- package/dist/react-ui.mjs +102 -190
- package/dist/{toaster-FX787Evl.d.cts → toaster-CKS4zoRY.d.cts} +7 -2
- package/dist/{toaster-BTfAUpDp.d.ts → toaster-DLJ_2W9u.d.ts} +7 -2
- package/package.json +1 -1
package/dist/react-ui.cjs
CHANGED
|
@@ -99684,7 +99684,8 @@ var QuizContextSchema = zod.z.object({
|
|
|
99684
99684
|
originalSubject: zod.z.string().optional(),
|
|
99685
99685
|
originalCategory: zod.z.string().optional(),
|
|
99686
99686
|
originalTopic: zod.z.string().optional(),
|
|
99687
|
-
loDescription: zod.z.string().optional().describe("The full description of the learning objective for deep context.")
|
|
99687
|
+
loDescription: zod.z.string().optional().describe("The full description of the learning objective for deep context."),
|
|
99688
|
+
gradeBand: zod.z.string().optional()
|
|
99688
99689
|
});
|
|
99689
99690
|
var BaseQuestionGenerationClientInputSchema = zod.z.object({
|
|
99690
99691
|
language: zod.z.string().optional().default("English"),
|
|
@@ -101235,189 +101236,122 @@ var supportedQuestionTypesForAI = [
|
|
|
101235
101236
|
{ value: "sequence", label: "Sequence" },
|
|
101236
101237
|
{ value: "matching", label: "Matching" }
|
|
101237
101238
|
];
|
|
101238
|
-
var contextOptions = [
|
|
101239
|
-
{ shortContextId: "A", contextId: "THEO_ABS", contextDescription: "L\xFD thuy\u1EBFt/Tr\u1EEBu t\u01B0\u1EE3ng", contextExample: '"Ph\xE1t bi\u1EC3u \u0111\u1ECBnh lu\u1EADt III Newton." ho\u1EB7c "Gi\u1EA3i th\xEDch kh\xE1i ni\u1EC7m \u0111\u1EA1o h\xE0m."', keywords: "l\xFD thuy\u1EBFt, tr\u1EEBu t\u01B0\u1EE3ng, \u0111\u1ECBnh ngh\u0129a, kh\xE1i ni\u1EC7m, nguy\xEAn l\xFD, c\xF4ng th\u1EE9c, \u0111\u1ECBnh lu\u1EADt" },
|
|
101240
|
-
{ shortContextId: "B", contextId: "SPEC_CASE", contextDescription: "V\xED d\u1EE5 C\u1EE5 th\u1EC3/Tr\u01B0\u1EDDng h\u1EE3p Ri\xEAng", contextExample: '"T\xEDnh l\u1EF1c t\xE1c d\u1EE5ng l\xEAn v\u1EADt n\u1EB7ng 2kg r\u01A1i t\u1EF1 do." ho\u1EB7c "Cho h\xE0m s\u1ED1 y = x^2, t\xECm \u0111\u1EA1o h\xE0m t\u1EA1i x = 3."', keywords: "v\xED d\u1EE5, c\u1EE5 th\u1EC3, tr\u01B0\u1EDDng h\u1EE3p ri\xEAng, \xE1p d\u1EE5ng, t\xEDnh to\xE1n, minh h\u1ECDa, s\u1ED1 li\u1EC7u c\u1EE5 th\u1EC3" },
|
|
101241
|
-
{ shortContextId: "C", contextId: "NAT_OBS", contextDescription: "Hi\u1EC7n t\u01B0\u1EE3ng T\u1EF1 nhi\xEAn/Quan s\xE1t", contextExample: '"Gi\u1EA3i th\xEDch t\u1EA1i sao c\u1EA7u v\u1ED3ng xu\u1EA5t hi\u1EC7n sau c\u01A1n m\u01B0a." ho\u1EB7c "M\xF4 t\u1EA3 qu\xE1 tr\xECnh quang h\u1EE3p \u1EDF l\xE1 c\xE2y."', keywords: "hi\u1EC7n t\u01B0\u1EE3ng, t\u1EF1 nhi\xEAn, quan s\xE1t, gi\u1EA3i th\xEDch, m\xF4 t\u1EA3, th\u1EBF gi\u1EDBi th\u1EF1c, sinh h\u1ECDc, v\u1EADt l\xFD" },
|
|
101242
|
-
{ shortContextId: "D", contextId: "TECH_ENG", contextDescription: "\u1EE8ng d\u1EE5ng C\xF4ng ngh\u1EC7/K\u1EF9 thu\u1EADt", contextExample: '"Nguy\xEAn l\xFD ho\u1EA1t \u0111\u1ED9ng c\u1EE7a \u0111\u1ED9ng c\u01A1 \u0111\u1ED1t trong l\xE0 g\xEC?" ho\u1EB7c "Pin m\u1EB7t tr\u1EDDi chuy\u1EC3n \u0111\u1ED5i n\u0103ng l\u01B0\u1EE3ng \xE1nh s\xE1ng th\xE0nh \u0111i\u1EC7n n\u0103ng nh\u01B0 th\u1EBF n\xE0o?"', keywords: "\u1EE9ng d\u1EE5ng, c\xF4ng ngh\u1EC7, k\u1EF9 thu\u1EADt, thi\u1EBFt b\u1ECB, m\xE1y m\xF3c, ho\u1EA1t \u0111\u1ED9ng, nguy\xEAn l\xFD, ch\u1EBF t\u1EA1o" },
|
|
101243
|
-
{ shortContextId: "E", contextId: "EXP_INV", contextDescription: "Th\xED nghi\u1EC7m/\u0110i\u1EC1u tra Khoa h\u1ECDc", contextExample: '"Thi\u1EBFt k\u1EBF th\xED nghi\u1EC7m ch\u1EE9ng minh \u0111\u1ECBnh lu\u1EADt b\u1EA3o to\xE0n n\u0103ng l\u01B0\u1EE3ng." ho\u1EB7c "Ph\xE2n t\xEDch k\u1EBFt qu\u1EA3 th\xED nghi\u1EC7m v\u1EC1 t\u1ED1c \u0111\u1ED9 ph\u1EA3n \u1EE9ng."', keywords: "th\xED nghi\u1EC7m, \u0111i\u1EC1u tra, khoa h\u1ECDc, thi\u1EBFt k\u1EBF, quy tr\xECnh, k\u1EBFt qu\u1EA3, ph\xE2n t\xEDch, d\u1EEF li\u1EC7u" },
|
|
101244
|
-
{ shortContextId: "F", contextId: "REAL_PROB", contextDescription: "V\u1EA5n \u0111\u1EC1 Th\u1EF1c t\u1EBF/X\xE3 h\u1ED9i/M\xF4i tr\u01B0\u1EDDng", contextExample: '"\u0110\u1EC1 xu\u1EA5t gi\u1EA3i ph\xE1p gi\u1EA3m thi\u1EC3u \xF4 nhi\u1EC5m kh\xF4ng kh\xED t\u1EA1i \u0111\xF4 th\u1ECB." ho\u1EB7c "Ph\xE2n t\xEDch \u1EA3nh h\u01B0\u1EDFng c\u1EE7a bi\u1EBFn \u0111\u1ED5i kh\xED h\u1EADu \u0111\u1EBFn n\xF4ng nghi\u1EC7p."', keywords: "v\u1EA5n \u0111\u1EC1, th\u1EF1c t\u1EBF, x\xE3 h\u1ED9i, m\xF4i tr\u01B0\u1EDDng, gi\u1EA3i ph\xE1p, ph\xE2n t\xEDch, \u1EA3nh h\u01B0\u1EDFng, b\u1EC1n v\u1EEFng" },
|
|
101245
|
-
{ shortContextId: "G", contextId: "DATA_MOD", contextDescription: "Di\u1EC5n gi\u1EA3i D\u1EEF li\u1EC7u/M\xF4 h\xECnh h\xF3a", contextExample: '"D\u1EF1a v\xE0o bi\u1EC3u \u0111\u1ED3, nh\u1EADn x\xE9t xu h\u01B0\u1EDBng nhi\u1EC7t \u0111\u1ED9 to\xE0n c\u1EA7u." ho\u1EB7c "X\xE2y d\u1EF1ng m\xF4 h\xECnh to\xE1n h\u1ECDc m\xF4 t\u1EA3 s\u1EF1 t\u0103ng tr\u01B0\u1EDFng d\xE2n s\u1ED1."', keywords: "d\u1EEF li\u1EC7u, bi\u1EC3u \u0111\u1ED3, b\u1EA3ng s\u1ED1 li\u1EC7u, m\xF4 h\xECnh, di\u1EC5n gi\u1EA3i, ph\xE2n t\xEDch, xu h\u01B0\u1EDBng, d\u1EF1 \u0111o\xE1n" },
|
|
101246
|
-
{ shortContextId: "H", contextId: "HIST_SCI", contextDescription: "L\u1ECBch s\u1EED/Ph\xE1t tri\u1EC3n Khoa h\u1ECDc", contextExample: '"Tr\xECnh b\xE0y b\u1ED1i c\u1EA3nh ra \u0111\u1EDDi thuy\u1EBFt t\u01B0\u01A1ng \u0111\u1ED1i c\u1EE7a Einstein." ho\u1EB7c "Ai l\xE0 ng\u01B0\u1EDDi \u0111\u1EA7u ti\xEAn ph\xE1t hi\u1EC7n ra c\u1EA5u tr\xFAc DNA?"', keywords: "l\u1ECBch s\u1EED, ph\xE1t tri\u1EC3n, khoa h\u1ECDc, nh\xE0 khoa h\u1ECDc, ph\xE1t minh, kh\xE1m ph\xE1, b\u1ED1i c\u1EA3nh" },
|
|
101247
|
-
{ shortContextId: "I", contextId: "INTERDISC", contextDescription: "Li\xEAn ng\xE0nh (Interdisciplinary)", contextExample: '"S\u1EED d\u1EE5ng ki\u1EBFn th\u1EE9c To\xE1n v\xE0 V\u1EADt l\xFD \u0111\u1EC3 t\xEDnh qu\u1EF9 \u0111\u1EA1o c\u1EE7a v\u1EADt n\xE9m xi\xEAn." ho\u1EB7c "Ph\xE2n t\xEDch c\u01A1 ch\u1EBF h\xF3a sinh c\u1EE7a qu\xE1 tr\xECnh ti\xEAu h\xF3a."', keywords: "li\xEAn ng\xE0nh, t\xEDch h\u1EE3p, To\xE1n-L\xFD, Sinh-H\xF3a, Khoa h\u1ECDc-C\xF4ng ngh\u1EC7, k\u1EBFt n\u1ED1i ki\u1EBFn th\u1EE9c" },
|
|
101248
|
-
{ shortContextId: "J", contextId: "HYPO_COMP", contextDescription: "Gi\u1EA3 \u0111\u1ECBnh/So s\xE1nh T\xECnh hu\u1ED1ng", contextExample: '"N\u1EBFu Tr\xE1i \u0110\u1EA5t kh\xF4ng c\xF3 t\u1EEB tr\u01B0\u1EDDng th\xEC \u0111i\u1EC1u g\xEC s\u1EBD x\u1EA3y ra?" ho\u1EB7c "So s\xE1nh \u01B0u nh\u01B0\u1EE3c \u0111i\u1EC3m c\u1EE7a n\u0103ng l\u01B0\u1EE3ng h\u1EA1t nh\xE2n v\xE0 n\u0103ng l\u01B0\u1EE3ng m\u1EB7t tr\u1EDDi."', keywords: "gi\u1EA3 \u0111\u1ECBnh, so s\xE1nh, t\xECnh hu\u1ED1ng, n\u1EBFu...th\xEC, \u01B0u \u0111i\u1EC3m, nh\u01B0\u1EE3c \u0111i\u1EC3m, ph\xE2n t\xEDch, \u0111\xE1nh gi\xE1" },
|
|
101249
|
-
{ shortContextId: "__custom__", contextId: "__custom__", contextDescription: "Other (Custom Input)", contextExample: "", keywords: "custom, other, specific" }
|
|
101250
|
-
];
|
|
101251
|
-
var bloomLevelOptions = [
|
|
101252
|
-
{ value: "remembering", label: "Nh\u1EDB - D\u1EC5 (Remembering)" },
|
|
101253
|
-
{ value: "understanding", label: "Hi\u1EC3u - Trung B\xECnh (Understanding)" },
|
|
101254
|
-
{ value: "applying", label: "V\u1EADn D\u1EE5ng - Kh\xF3 (Applying)" }
|
|
101255
|
-
];
|
|
101256
|
-
var calculateCombinedDifficulty = (contextId, bloomLevel, qType, customContextInput) => {
|
|
101257
|
-
let contextScore = 1;
|
|
101258
|
-
const selectedContext = contextOptions.find((c4) => c4.contextId === contextId);
|
|
101259
|
-
if (selectedContext) {
|
|
101260
|
-
if (["THEO_ABS", "HIST_SCI", "__none__"].includes(selectedContext.contextId) || selectedContext.contextId === "__custom__" && !customContextInput.trim()) {
|
|
101261
|
-
contextScore = 1;
|
|
101262
|
-
} else if (["SPEC_CASE", "NAT_OBS", "DATA_MOD", "INTERDISC", "HYPO_COMP"].includes(selectedContext.contextId) || selectedContext.contextId === "__custom__" && customContextInput.trim()) {
|
|
101263
|
-
contextScore = 2;
|
|
101264
|
-
} else if (["TECH_ENG", "EXP_INV", "REAL_PROB"].includes(selectedContext.contextId)) {
|
|
101265
|
-
contextScore = 3;
|
|
101266
|
-
}
|
|
101267
|
-
} else if (contextId === "__custom__" && customContextInput.trim()) {
|
|
101268
|
-
contextScore = 2;
|
|
101269
|
-
}
|
|
101270
|
-
let bloomScore = 1;
|
|
101271
|
-
if (bloomLevel === "understanding") bloomScore = 2;
|
|
101272
|
-
else if (bloomLevel === "applying") bloomScore = 3;
|
|
101273
|
-
let questionTypeScore = 1;
|
|
101274
|
-
switch (qType) {
|
|
101275
|
-
case "true_false":
|
|
101276
|
-
case "multiple_choice":
|
|
101277
|
-
case "short_answer":
|
|
101278
|
-
questionTypeScore = 1;
|
|
101279
|
-
break;
|
|
101280
|
-
case "matching":
|
|
101281
|
-
case "fill_in_the_blanks":
|
|
101282
|
-
case "numeric":
|
|
101283
|
-
questionTypeScore = 2;
|
|
101284
|
-
break;
|
|
101285
|
-
case "sequence":
|
|
101286
|
-
case "multiple_response":
|
|
101287
|
-
questionTypeScore = 3;
|
|
101288
|
-
break;
|
|
101289
|
-
default:
|
|
101290
|
-
questionTypeScore = 1;
|
|
101291
|
-
}
|
|
101292
|
-
const totalScore = bloomScore + contextScore + questionTypeScore;
|
|
101293
|
-
if (totalScore <= 4) return "easy";
|
|
101294
|
-
if (totalScore <= 6) return "medium";
|
|
101295
|
-
return "hard";
|
|
101296
|
-
};
|
|
101297
101239
|
var AIQuestionGeneratorModal = ({
|
|
101298
101240
|
isOpen,
|
|
101299
101241
|
onClose,
|
|
101300
101242
|
onQuestionGenerated,
|
|
101301
|
-
language: language3
|
|
101302
|
-
|
|
101243
|
+
language: language3,
|
|
101244
|
+
questionType: questionTypeProp,
|
|
101245
|
+
subjects = [],
|
|
101246
|
+
topics = [],
|
|
101247
|
+
gradeLevels = [],
|
|
101248
|
+
bloomLevels = []
|
|
101303
101249
|
}) => {
|
|
101304
|
-
const [
|
|
101305
|
-
const [selectedContextId, setSelectedContextId] = React169.useState("__none__");
|
|
101306
|
-
const [customContextInput, setCustomContextInput] = React169.useState("");
|
|
101307
|
-
const [questionType, setQuestionType] = React169.useState("multiple_choice");
|
|
101308
|
-
const [selectedBloomLevel, setSelectedBloomLevel] = React169.useState("remembering");
|
|
101250
|
+
const [prompt, setPrompt] = React169.useState("");
|
|
101309
101251
|
const [isLoading, setIsLoading] = React169.useState(false);
|
|
101310
101252
|
const [error, setError] = React169.useState(null);
|
|
101311
|
-
const [computedDifficultyForDisplay, setComputedDifficultyForDisplay] = React169.useState(null);
|
|
101312
101253
|
const { toast: toast2 } = useToast();
|
|
101254
|
+
const [subjectCode, setSubjectCode] = React169.useState("");
|
|
101255
|
+
const [topicCode, setTopicCode] = React169.useState("");
|
|
101256
|
+
const [gradeBand, setGradeBand] = React169.useState("");
|
|
101257
|
+
const [bloomLevelCode, setBloomLevelCode] = React169.useState("");
|
|
101258
|
+
const [selectedQuestionType, setSelectedQuestionType] = React169.useState("multiple_choice");
|
|
101313
101259
|
const [numberOfOptions, setNumberOfOptions] = React169.useState(4);
|
|
101314
|
-
const [minCorrectAnswers, setMinCorrectAnswers] = React169.useState(
|
|
101315
|
-
const [maxCorrectAnswers, setMaxCorrectAnswers] = React169.useState(
|
|
101260
|
+
const [minCorrectAnswers, setMinCorrectAnswers] = React169.useState(2);
|
|
101261
|
+
const [maxCorrectAnswers, setMaxCorrectAnswers] = React169.useState(3);
|
|
101316
101262
|
const [isCaseSensitive, setIsCaseSensitive] = React169.useState(false);
|
|
101317
101263
|
const [numberOfBlanks, setNumberOfBlanks] = React169.useState(2);
|
|
101318
101264
|
const [numberOfSequenceItems, setNumberOfSequenceItems] = React169.useState(4);
|
|
101319
101265
|
const [numberOfMatchingPairs, setNumberOfMatchingPairs] = React169.useState(4);
|
|
101320
101266
|
const [isApiKeyManagerModalOpen, setIsApiKeyManagerModalOpen] = React169.useState(false);
|
|
101321
101267
|
const [geminiApiKeyExists, setGeminiApiKeyExists] = React169.useState(false);
|
|
101268
|
+
const finalQuestionType = questionTypeProp || selectedQuestionType;
|
|
101322
101269
|
React169.useEffect(() => {
|
|
101323
101270
|
if (isOpen) {
|
|
101324
|
-
|
|
101325
|
-
setSelectedContextId("__none__");
|
|
101326
|
-
setCustomContextInput("");
|
|
101327
|
-
setQuestionType("multiple_choice");
|
|
101328
|
-
setSelectedBloomLevel("remembering");
|
|
101271
|
+
setPrompt("");
|
|
101329
101272
|
setError(null);
|
|
101330
101273
|
setIsLoading(false);
|
|
101331
|
-
|
|
101332
|
-
|
|
101333
|
-
|
|
101334
|
-
|
|
101335
|
-
|
|
101336
|
-
setNumberOfSequenceItems(4);
|
|
101337
|
-
setNumberOfMatchingPairs(4);
|
|
101338
|
-
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
101339
|
-
}
|
|
101340
|
-
}, [isOpen]);
|
|
101341
|
-
React169.useEffect(() => {
|
|
101342
|
-
if (isOpen) {
|
|
101343
|
-
const difficulty = calculateCombinedDifficulty(selectedContextId, selectedBloomLevel, questionType, customContextInput);
|
|
101344
|
-
setComputedDifficultyForDisplay(difficulty);
|
|
101274
|
+
setSubjectCode("");
|
|
101275
|
+
setTopicCode("");
|
|
101276
|
+
setGradeBand("");
|
|
101277
|
+
setBloomLevelCode("");
|
|
101278
|
+
setSelectedQuestionType(questionTypeProp || "multiple_choice");
|
|
101345
101279
|
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
101346
101280
|
}
|
|
101347
|
-
}, [
|
|
101281
|
+
}, [isOpen, questionTypeProp]);
|
|
101282
|
+
const filteredTopics = React169.useMemo(() => {
|
|
101283
|
+
if (!subjectCode) return [];
|
|
101284
|
+
return topics.filter((t4) => t4.subjectCode === subjectCode);
|
|
101285
|
+
}, [subjectCode, topics]);
|
|
101348
101286
|
const handleApiKeyModalClose = () => {
|
|
101349
101287
|
setIsApiKeyManagerModalOpen(false);
|
|
101350
101288
|
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
101351
101289
|
};
|
|
101352
101290
|
const handleSubmit = async () => {
|
|
101353
|
-
if (!
|
|
101354
|
-
setError("Please provide a
|
|
101291
|
+
if (!prompt.trim()) {
|
|
101292
|
+
setError("Please provide a prompt for the question.");
|
|
101355
101293
|
return;
|
|
101356
101294
|
}
|
|
101357
101295
|
const geminiKey = APIKeyService.getAPIKey(GEMINI_API_KEY_SERVICE_NAME);
|
|
101358
101296
|
if (!geminiKey) {
|
|
101359
|
-
setError("Gemini API Key is not set. Please
|
|
101297
|
+
setError("Gemini API Key is not set. Please configure it.");
|
|
101360
101298
|
setGeminiApiKeyExists(false);
|
|
101361
101299
|
return;
|
|
101362
101300
|
}
|
|
101363
101301
|
setGeminiApiKeyExists(true);
|
|
101364
101302
|
setError(null);
|
|
101365
101303
|
setIsLoading(true);
|
|
101366
|
-
let contextDescriptionForAI = void 0;
|
|
101367
|
-
if (selectedContextId === "__custom__") {
|
|
101368
|
-
contextDescriptionForAI = customContextInput.trim() || void 0;
|
|
101369
|
-
} else if (selectedContextId && selectedContextId !== "__none__") {
|
|
101370
|
-
const selectedContextObj = contextOptions.find((c4) => c4.contextId === selectedContextId);
|
|
101371
|
-
contextDescriptionForAI = selectedContextObj?.contextDescription;
|
|
101372
|
-
}
|
|
101373
|
-
const finalDifficultyForAI = calculateCombinedDifficulty(selectedContextId, selectedBloomLevel, questionType, customContextInput);
|
|
101374
101304
|
try {
|
|
101375
|
-
|
|
101305
|
+
const quizContext = {
|
|
101306
|
+
plannedTopic: prompt,
|
|
101307
|
+
originalSubject: subjectCode,
|
|
101308
|
+
originalTopic: topicCode,
|
|
101309
|
+
gradeBand,
|
|
101310
|
+
plannedBloomLevel: bloomLevelCode
|
|
101311
|
+
};
|
|
101376
101312
|
const baseClientInput = {
|
|
101377
|
-
topic,
|
|
101378
101313
|
language: language3,
|
|
101379
|
-
|
|
101380
|
-
|
|
101381
|
-
contextDescription: contextDescriptionForAI,
|
|
101382
|
-
selectedContextId: selectedContextId !== "__none__" && selectedContextId !== "__custom__" ? selectedContextId : selectedContextId === "__custom__" && customContextInput.trim() ? "__custom__" : void 0
|
|
101314
|
+
difficulty: "medium",
|
|
101315
|
+
quizContext
|
|
101383
101316
|
};
|
|
101384
|
-
|
|
101317
|
+
let generatedResult = {};
|
|
101318
|
+
switch (finalQuestionType) {
|
|
101385
101319
|
case "true_false":
|
|
101386
|
-
|
|
101320
|
+
generatedResult = await generateTrueFalseQuestion(baseClientInput, geminiKey);
|
|
101387
101321
|
break;
|
|
101388
101322
|
case "multiple_choice":
|
|
101389
|
-
|
|
101323
|
+
generatedResult = await generateMCQQuestion({ ...baseClientInput, numberOfOptions }, geminiKey);
|
|
101390
101324
|
break;
|
|
101391
101325
|
case "multiple_response":
|
|
101392
|
-
|
|
101393
|
-
throw new Error("Invalid settings for Multiple Response correct answers count or number of options.");
|
|
101394
|
-
}
|
|
101395
|
-
generatedQuestionData = await generateMRQQuestion({ ...baseClientInput, numberOfOptions, minCorrectAnswers, maxCorrectAnswers }, geminiKey);
|
|
101326
|
+
generatedResult = await generateMRQQuestion({ ...baseClientInput, numberOfOptions, minCorrectAnswers, maxCorrectAnswers }, geminiKey);
|
|
101396
101327
|
break;
|
|
101397
101328
|
case "short_answer":
|
|
101398
|
-
|
|
101329
|
+
generatedResult = await generateShortAnswerQuestion({ ...baseClientInput, isCaseSensitive }, geminiKey);
|
|
101399
101330
|
break;
|
|
101400
101331
|
case "numeric":
|
|
101401
|
-
|
|
101332
|
+
generatedResult = await generateNumericQuestion({ ...baseClientInput, allowDecimals: true, tolerance: 0 }, geminiKey);
|
|
101402
101333
|
break;
|
|
101403
101334
|
case "fill_in_the_blanks":
|
|
101404
|
-
|
|
101335
|
+
generatedResult = await generateFillInTheBlanksQuestion({ ...baseClientInput, numberOfBlanks, isCaseSensitive }, geminiKey);
|
|
101405
101336
|
break;
|
|
101406
101337
|
case "sequence":
|
|
101407
|
-
|
|
101338
|
+
generatedResult = await generateSequenceQuestion({ ...baseClientInput, numberOfItems: numberOfSequenceItems }, geminiKey);
|
|
101408
101339
|
break;
|
|
101409
101340
|
case "matching":
|
|
101410
|
-
|
|
101341
|
+
generatedResult = await generateMatchingQuestion({ ...baseClientInput, numberOfPairs: numberOfMatchingPairs, shuffleOptions: true }, geminiKey);
|
|
101411
101342
|
break;
|
|
101412
101343
|
default:
|
|
101413
|
-
|
|
101414
|
-
|
|
101415
|
-
|
|
101416
|
-
|
|
101417
|
-
|
|
101418
|
-
|
|
101419
|
-
completeQuestion
|
|
101420
|
-
completeQuestion.
|
|
101344
|
+
throw new Error(`AI generation for '${finalQuestionType}' is not implemented in this flow.`);
|
|
101345
|
+
}
|
|
101346
|
+
if (generatedResult.error) {
|
|
101347
|
+
throw new Error(generatedResult.error);
|
|
101348
|
+
}
|
|
101349
|
+
if (generatedResult.question) {
|
|
101350
|
+
const completeQuestion = generatedResult.question;
|
|
101351
|
+
completeQuestion.subject = subjectCode;
|
|
101352
|
+
completeQuestion.topic = topicCode;
|
|
101353
|
+
completeQuestion.gradeBand = gradeBand;
|
|
101354
|
+
completeQuestion.bloomLevel = bloomLevelCode;
|
|
101421
101355
|
if (completeQuestion.points === void 0) completeQuestion.points = 10;
|
|
101422
101356
|
onQuestionGenerated(completeQuestion);
|
|
101423
101357
|
toast2({ title: "AI Question Generated", description: "Review and edit the generated question." });
|
|
@@ -101427,9 +101361,9 @@ var AIQuestionGeneratorModal = ({
|
|
|
101427
101361
|
}
|
|
101428
101362
|
} catch (e3) {
|
|
101429
101363
|
console.error("AI Question Generation Error:", e3);
|
|
101430
|
-
let errorMessage = e3.message || "An unknown error occurred
|
|
101431
|
-
if (typeof errorMessage === "string" &&
|
|
101432
|
-
errorMessage = "The provided Google Gemini API Key is invalid
|
|
101364
|
+
let errorMessage = e3.message || "An unknown error occurred.";
|
|
101365
|
+
if (typeof errorMessage === "string" && errorMessage.includes("API key not valid")) {
|
|
101366
|
+
errorMessage = "The provided Google Gemini API Key is invalid. Please check it.";
|
|
101433
101367
|
setGeminiApiKeyExists(false);
|
|
101434
101368
|
}
|
|
101435
101369
|
setError(errorMessage);
|
|
@@ -101438,11 +101372,17 @@ var AIQuestionGeneratorModal = ({
|
|
|
101438
101372
|
setIsLoading(false);
|
|
101439
101373
|
}
|
|
101440
101374
|
};
|
|
101375
|
+
const comboboxOptions = {
|
|
101376
|
+
subjects: subjects.map((s4) => ({ value: s4.code, label: s4.name })),
|
|
101377
|
+
topics: filteredTopics.map((t4) => ({ value: t4.code, label: t4.name })),
|
|
101378
|
+
gradeLevels: gradeLevels.map((g) => ({ value: g.code, label: g.name })),
|
|
101379
|
+
bloomLevels: bloomLevels.map((b2) => ({ value: b2.code, label: b2.name }))
|
|
101380
|
+
};
|
|
101441
101381
|
const renderSpecificParams = () => {
|
|
101442
|
-
switch (
|
|
101382
|
+
switch (finalQuestionType) {
|
|
101443
101383
|
case "multiple_choice":
|
|
101444
101384
|
case "multiple_response":
|
|
101445
|
-
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-options" }, "Number of Options (2-
|
|
101385
|
+
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2 pt-4 border-t" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-options" }, "Number of Options (2-8)"), /* @__PURE__ */ React169__namespace.default.createElement(
|
|
101446
101386
|
Input,
|
|
101447
101387
|
{
|
|
101448
101388
|
id: "ai-num-options",
|
|
@@ -101450,76 +101390,32 @@ var AIQuestionGeneratorModal = ({
|
|
|
101450
101390
|
value: numberOfOptions,
|
|
101451
101391
|
onChange: (e3) => setNumberOfOptions(parseInt(e3.target.value, 10)),
|
|
101452
101392
|
min: 2,
|
|
101453
|
-
max:
|
|
101393
|
+
max: 8
|
|
101454
101394
|
}
|
|
101455
|
-
),
|
|
101395
|
+
), finalQuestionType === "multiple_response" && /* @__PURE__ */ React169__namespace.default.createElement(React169__namespace.default.Fragment, null, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-min-correct" }, "Min Correct Answers"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-min-correct", type: "number", value: minCorrectAnswers, onChange: (e3) => setMinCorrectAnswers(parseInt(e3.target.value, 10)), min: 1, max: numberOfOptions }), /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-max-correct" }, "Max Correct Answers"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-max-correct", type: "number", value: maxCorrectAnswers, onChange: (e3) => setMaxCorrectAnswers(parseInt(e3.target.value, 10)), min: minCorrectAnswers, max: numberOfOptions })));
|
|
101456
101396
|
case "short_answer":
|
|
101457
101397
|
case "fill_in_the_blanks":
|
|
101458
|
-
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "flex items-center space-x-2" }, /* @__PURE__ */ React169__namespace.default.createElement("input", { type: "checkbox", id: "ai-case-sensitive", checked: isCaseSensitive, onChange: (e3) => setIsCaseSensitive(e3.target.checked), className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary" }), /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-case-sensitive" }, "Case Sensitive Answers"),
|
|
101398
|
+
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "flex items-center space-x-2 pt-4 border-t" }, /* @__PURE__ */ React169__namespace.default.createElement("input", { type: "checkbox", id: "ai-case-sensitive", checked: isCaseSensitive, onChange: (e3) => setIsCaseSensitive(e3.target.checked), className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary" }), /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-case-sensitive" }, "Case Sensitive Answers"), finalQuestionType === "fill_in_the_blanks" && /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-1 ml-4" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-blanks" }, "Number of Blanks (1-5)"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-num-blanks", type: "number", value: numberOfBlanks, onChange: (e3) => setNumberOfBlanks(parseInt(e3.target.value, 10)), min: 1, max: 5 })));
|
|
101459
101399
|
case "sequence":
|
|
101460
|
-
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-seq-items" }, "Number of Items to Sequence (2-10)"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-num-seq-items", type: "number", value: numberOfSequenceItems, onChange: (e3) => setNumberOfSequenceItems(parseInt(e3.target.value, 10)), min: 2, max: 10 }));
|
|
101400
|
+
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2 pt-4 border-t" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-seq-items" }, "Number of Items to Sequence (2-10)"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-num-seq-items", type: "number", value: numberOfSequenceItems, onChange: (e3) => setNumberOfSequenceItems(parseInt(e3.target.value, 10)), min: 2, max: 10 }));
|
|
101461
101401
|
case "matching":
|
|
101462
|
-
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-match-pairs" }, "Number of Pairs to Match (2-8)"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-num-match-pairs", type: "number", value: numberOfMatchingPairs, onChange: (e3) => setNumberOfMatchingPairs(parseInt(e3.target.value, 10)), min: 2, max: 8 }));
|
|
101402
|
+
return /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2 pt-4 border-t" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-num-match-pairs" }, "Number of Pairs to Match (2-8)"), /* @__PURE__ */ React169__namespace.default.createElement(Input, { id: "ai-num-match-pairs", type: "number", value: numberOfMatchingPairs, onChange: (e3) => setNumberOfMatchingPairs(parseInt(e3.target.value, 10)), min: 2, max: 8 }));
|
|
101463
101403
|
default:
|
|
101464
101404
|
return null;
|
|
101465
101405
|
}
|
|
101466
101406
|
};
|
|
101467
101407
|
return /* @__PURE__ */ React169__namespace.default.createElement(React169__namespace.default.Fragment, null, /* @__PURE__ */ React169__namespace.default.createElement(Dialog2, { open: isOpen, onOpenChange: (open) => {
|
|
101468
101408
|
if (!open) onClose();
|
|
101469
|
-
} }, /* @__PURE__ */ React169__namespace.default.createElement(DialogContent2, { className: "sm:max-w-[
|
|
101470
|
-
Button,
|
|
101471
|
-
{
|
|
101472
|
-
variant: "link",
|
|
101473
|
-
className: "p-0 h-auto text-xs text-amber-700 hover:text-amber-800 mt-1",
|
|
101474
|
-
onClick: () => {
|
|
101475
|
-
onClose();
|
|
101476
|
-
setIsApiKeyManagerModalOpen(true);
|
|
101477
|
-
}
|
|
101478
|
-
},
|
|
101479
|
-
"Set API Key Now"
|
|
101480
|
-
)))), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-topic" }, "Topic"), /* @__PURE__ */ React169__namespace.default.createElement(
|
|
101409
|
+
} }, /* @__PURE__ */ React169__namespace.default.createElement(DialogContent2, { className: "sm:max-w-[600px]" }, /* @__PURE__ */ React169__namespace.default.createElement(DialogHeader, null, /* @__PURE__ */ React169__namespace.default.createElement(DialogTitle2, { className: "flex items-center font-headline text-2xl" }, /* @__PURE__ */ React169__namespace.default.createElement(WandSparkles, { className: "mr-2 h-6 w-6 text-primary" }), " AI Question Generator"), /* @__PURE__ */ React169__namespace.default.createElement(DialogDescription2, null, "Provide a prompt and metadata to generate a '", finalQuestionType, "' question.")), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-4 py-4 max-h-[60vh] overflow-y-auto px-2" }, !geminiApiKeyExists && /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "p-3 mb-4 border border-amber-500 bg-amber-50 rounded-md text-amber-700" }), !questionTypeProp && /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-q-type-select" }, "Question Type"), /* @__PURE__ */ React169__namespace.default.createElement(Select2, { value: selectedQuestionType, onValueChange: (v) => setSelectedQuestionType(v) }, /* @__PURE__ */ React169__namespace.default.createElement(SelectTrigger2, { id: "ai-q-type-select" }, /* @__PURE__ */ React169__namespace.default.createElement(SelectValue2, null)), /* @__PURE__ */ React169__namespace.default.createElement(SelectContent2, null, supportedQuestionTypesForAI.map((type) => /* @__PURE__ */ React169__namespace.default.createElement(SelectItem2, { key: type.value, value: type.value }, type.label))))), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-prompt" }, "Prompt / Topic"), /* @__PURE__ */ React169__namespace.default.createElement(
|
|
101481
101410
|
Textarea,
|
|
101482
101411
|
{
|
|
101483
|
-
id: "ai-
|
|
101484
|
-
value:
|
|
101485
|
-
onChange: (e3) =>
|
|
101486
|
-
placeholder: "e.g.,
|
|
101487
|
-
className: "min-h-[
|
|
101412
|
+
id: "ai-prompt",
|
|
101413
|
+
value: prompt,
|
|
101414
|
+
onChange: (e3) => setPrompt(e3.target.value),
|
|
101415
|
+
placeholder: "e.g., The process of photosynthesis, The causes of World War II, Basic Algebra Equations",
|
|
101416
|
+
className: "min-h-[100px]"
|
|
101488
101417
|
}
|
|
101489
|
-
)), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, {
|
|
101490
|
-
Select2,
|
|
101491
|
-
{
|
|
101492
|
-
value: selectedContextId,
|
|
101493
|
-
onValueChange: (value) => setSelectedContextId(value)
|
|
101494
|
-
},
|
|
101495
|
-
/* @__PURE__ */ React169__namespace.default.createElement(SelectTrigger2, { id: "ai-context-select" }, /* @__PURE__ */ React169__namespace.default.createElement(SelectValue2, { placeholder: "Select a context or choose 'Other'..." })),
|
|
101496
|
-
/* @__PURE__ */ React169__namespace.default.createElement(SelectContent2, null, /* @__PURE__ */ React169__namespace.default.createElement(SelectItem2, { value: "__none__" }, "None (General Topic)"), contextOptions.map((opt) => /* @__PURE__ */ React169__namespace.default.createElement(SelectItem2, { key: opt.contextId, value: opt.contextId }, opt.contextDescription, " ", opt.shortContextId !== "__custom__" ? `(${opt.shortContextId})` : "")))
|
|
101497
|
-
)), selectedContextId === "__custom__" && /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-custom-context" }, "Custom Context"), /* @__PURE__ */ React169__namespace.default.createElement(
|
|
101498
|
-
Textarea,
|
|
101499
|
-
{
|
|
101500
|
-
id: "ai-custom-context",
|
|
101501
|
-
value: customContextInput,
|
|
101502
|
-
onChange: (e3) => setCustomContextInput(e3.target.value),
|
|
101503
|
-
placeholder: "Enter your specific context here...",
|
|
101504
|
-
className: "min-h-[60px]"
|
|
101505
|
-
}
|
|
101506
|
-
)), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "grid grid-cols-2 gap-4" }, /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-question-type" }, "Question Type"), /* @__PURE__ */ React169__namespace.default.createElement(
|
|
101507
|
-
Select2,
|
|
101508
|
-
{
|
|
101509
|
-
value: questionType,
|
|
101510
|
-
onValueChange: (value) => setQuestionType(value)
|
|
101511
|
-
},
|
|
101512
|
-
/* @__PURE__ */ React169__namespace.default.createElement(SelectTrigger2, { id: "ai-question-type" }, /* @__PURE__ */ React169__namespace.default.createElement(SelectValue2, { placeholder: "Select question type" })),
|
|
101513
|
-
/* @__PURE__ */ React169__namespace.default.createElement(SelectContent2, null, supportedQuestionTypesForAI.map((qType) => /* @__PURE__ */ React169__namespace.default.createElement(SelectItem2, { key: qType.value, value: qType.value }, qType.label)))
|
|
101514
|
-
)), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, { htmlFor: "ai-bloom-level" }, "Bloom Level"), /* @__PURE__ */ React169__namespace.default.createElement(
|
|
101515
|
-
Select2,
|
|
101516
|
-
{
|
|
101517
|
-
value: selectedBloomLevel,
|
|
101518
|
-
onValueChange: (value) => setSelectedBloomLevel(value)
|
|
101519
|
-
},
|
|
101520
|
-
/* @__PURE__ */ React169__namespace.default.createElement(SelectTrigger2, { id: "ai-bloom-level" }, /* @__PURE__ */ React169__namespace.default.createElement(SelectValue2, { placeholder: "Select Bloom Level" })),
|
|
101521
|
-
/* @__PURE__ */ React169__namespace.default.createElement(SelectContent2, null, bloomLevelOptions.map((level) => /* @__PURE__ */ React169__namespace.default.createElement(SelectItem2, { key: level.value, value: level.value }, level.label)))
|
|
101522
|
-
))), renderSpecificParams(), computedDifficultyForDisplay && /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "mt-3 p-3 border rounded-md bg-secondary/50" }, /* @__PURE__ */ React169__namespace.default.createElement("p", { className: "text-sm font-medium text-foreground" }, "Calculated AI Difficulty: ", /* @__PURE__ */ React169__namespace.default.createElement("span", { className: "font-bold text-primary capitalize" }, computedDifficultyForDisplay))), error && /* @__PURE__ */ React169__namespace.default.createElement("p", { className: "text-sm text-destructive flex items-center mt-2" }, /* @__PURE__ */ React169__namespace.default.createElement(TriangleAlert, { className: "mr-1 h-4 w-4" }), " ", error)), /* @__PURE__ */ React169__namespace.default.createElement(DialogFooter, null, /* @__PURE__ */ React169__namespace.default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React169__namespace.default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React169__namespace.default.createElement(Button, { type: "button", onClick: handleSubmit, disabled: isLoading || !topic.trim() || !geminiApiKeyExists }, isLoading ? /* @__PURE__ */ React169__namespace.default.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React169__namespace.default.createElement(WandSparkles, { className: "mr-2 h-4 w-4" }), "Generate Question")))), /* @__PURE__ */ React169__namespace.default.createElement(APIKeyManagerModal, { isOpen: isApiKeyManagerModalOpen, onClose: handleApiKeyModalClose }));
|
|
101418
|
+
)), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "grid grid-cols-2 gap-4" }, /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, null, "Subject"), /* @__PURE__ */ React169__namespace.default.createElement(EditableCombobox, { options: comboboxOptions.subjects, value: subjectCode, onChange: setSubjectCode, placeholder: "Select or type a Subject..." })), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, null, "Topic"), /* @__PURE__ */ React169__namespace.default.createElement(EditableCombobox, { options: comboboxOptions.topics, value: topicCode, onChange: setTopicCode, placeholder: "Select or type a Topic...", disabled: !subjectCode })), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, null, "Grade Level"), /* @__PURE__ */ React169__namespace.default.createElement(EditableCombobox, { options: comboboxOptions.gradeLevels, value: gradeBand, onChange: setGradeBand, placeholder: "Select or type a Grade..." })), /* @__PURE__ */ React169__namespace.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__namespace.default.createElement(Label2, null, "Bloom's Level"), /* @__PURE__ */ React169__namespace.default.createElement(EditableCombobox, { options: comboboxOptions.bloomLevels, value: bloomLevelCode, onChange: setBloomLevelCode, placeholder: "Select a Bloom's Level..." }))), renderSpecificParams(), error && /* @__PURE__ */ React169__namespace.default.createElement("p", { className: "text-sm text-destructive flex items-center mt-2" }, /* @__PURE__ */ React169__namespace.default.createElement(TriangleAlert, { className: "mr-1 h-4 w-4" }), " ", error)), /* @__PURE__ */ React169__namespace.default.createElement(DialogFooter, null, /* @__PURE__ */ React169__namespace.default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React169__namespace.default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React169__namespace.default.createElement(Button, { type: "button", onClick: handleSubmit, disabled: isLoading || !prompt.trim() || !geminiApiKeyExists }, isLoading ? /* @__PURE__ */ React169__namespace.default.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React169__namespace.default.createElement(WandSparkles, { className: "mr-2 h-4 w-4" }), "Generate Question")))), /* @__PURE__ */ React169__namespace.default.createElement(APIKeyManagerModal, { isOpen: isApiKeyManagerModalOpen, onClose: handleApiKeyModalClose }));
|
|
101523
101419
|
};
|
|
101524
101420
|
|
|
101525
101421
|
// src/react-ui/components/authoring/AIFullQuizGeneratorModal.tsx
|
|
@@ -102350,7 +102246,7 @@ async function generateCodingQuestion(clientInput, apiKey) {
|
|
|
102350
102246
|
var MAX_ATTEMPTS = 3;
|
|
102351
102247
|
var RETRY_DELAY_MS10 = 2e3;
|
|
102352
102248
|
var delay = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
102353
|
-
var
|
|
102249
|
+
var calculateCombinedDifficulty = (plannedQ) => {
|
|
102354
102250
|
const { plannedBloomLevel, plannedQuestionType, plannedContextId } = plannedQ;
|
|
102355
102251
|
let contextScore = 1;
|
|
102356
102252
|
if (["SPEC_CASE", "NAT_OBS", "DATA_MOD", "INTERDISC", "HYPO_COMP"].includes(plannedContextId || "")) contextScore = 2;
|
|
@@ -102407,7 +102303,7 @@ async function generateQuestionsFromQuizPlan(clientInput, apiKey) {
|
|
|
102407
102303
|
const imageUrl = plannedQ.imageId && imageContexts ? imageContexts.find((ctx) => ctx.id === plannedQ.imageId)?.imageUrl : void 0;
|
|
102408
102304
|
const baseClientInput = {
|
|
102409
102305
|
language: language3,
|
|
102410
|
-
difficulty:
|
|
102306
|
+
difficulty: calculateCombinedDifficulty(plannedQ),
|
|
102411
102307
|
quizContext,
|
|
102412
102308
|
imageUrl
|
|
102413
102309
|
};
|
|
@@ -102489,6 +102385,22 @@ async function generateQuestionsFromQuizPlan(clientInput, apiKey) {
|
|
|
102489
102385
|
return { generatedQuestions, errors: errors2.length > 0 ? errors2 : void 0 };
|
|
102490
102386
|
}
|
|
102491
102387
|
|
|
102388
|
+
// src/data/contextOptions.ts
|
|
102389
|
+
init_react_shim();
|
|
102390
|
+
var contextOptions = [
|
|
102391
|
+
{ shortContextId: "A", contextId: "THEO_ABS", contextDescription: "L\xFD thuy\u1EBFt/Tr\u1EEBu t\u01B0\u1EE3ng", contextExample: '"Ph\xE1t bi\u1EC3u \u0111\u1ECBnh lu\u1EADt III Newton." ho\u1EB7c "Gi\u1EA3i th\xEDch kh\xE1i ni\u1EC7m \u0111\u1EA1o h\xE0m."', keywords: "l\xFD thuy\u1EBFt, tr\u1EEBu t\u01B0\u1EE3ng, \u0111\u1ECBnh ngh\u0129a, kh\xE1i ni\u1EC7m, nguy\xEAn l\xFD, c\xF4ng th\u1EE9c, \u0111\u1ECBnh lu\u1EADt" },
|
|
102392
|
+
{ shortContextId: "B", contextId: "SPEC_CASE", contextDescription: "V\xED d\u1EE5 C\u1EE5 th\u1EC3/Tr\u01B0\u1EDDng h\u1EE3p Ri\xEAng", contextExample: '"T\xEDnh l\u1EF1c t\xE1c d\u1EE5ng l\xEAn v\u1EADt n\u1EB7ng 2kg r\u01A1i t\u1EF1 do." ho\u1EB7c "Cho h\xE0m s\u1ED1 y = x^2, t\xECm \u0111\u1EA1o h\xE0m t\u1EA1i x = 3."', keywords: "v\xED d\u1EE5, c\u1EE5 th\u1EC3, tr\u01B0\u1EDDng h\u1EE3p ri\xEAng, \xE1p d\u1EE5ng, t\xEDnh to\xE1n, minh h\u1ECDa, s\u1ED1 li\u1EC7u c\u1EE5 th\u1EC3" },
|
|
102393
|
+
{ shortContextId: "C", contextId: "NAT_OBS", contextDescription: "Hi\u1EC7n t\u01B0\u1EE3ng T\u1EF1 nhi\xEAn/Quan s\xE1t", contextExample: '"Gi\u1EA3i th\xEDch t\u1EA1i sao c\u1EA7u v\u1ED3ng xu\u1EA5t hi\u1EC7n sau c\u01A1n m\u01B0a." ho\u1EB7c "M\xF4 t\u1EA3 qu\xE1 tr\xECnh quang h\u1EE3p \u1EDF l\xE1 c\xE2y."', keywords: "hi\u1EC7n t\u01B0\u1EE3ng, t\u1EF1 nhi\xEAn, quan s\xE1t, gi\u1EA3i th\xEDch, m\xF4 t\u1EA3, th\u1EBF gi\u1EDBi th\u1EF1c, sinh h\u1ECDc, v\u1EADt l\xFD" },
|
|
102394
|
+
{ shortContextId: "D", contextId: "TECH_ENG", contextDescription: "\u1EE8ng d\u1EE5ng C\xF4ng ngh\u1EC7/K\u1EF9 thu\u1EADt", contextExample: '"Nguy\xEAn l\xFD ho\u1EA1t \u0111\u1ED9ng c\u1EE7a \u0111\u1ED9ng c\u01A1 \u0111\u1ED1t trong l\xE0 g\xEC?" ho\u1EB7c "Pin m\u1EB7t tr\u1EDDi chuy\u1EC3n \u0111\u1ED5i n\u0103ng l\u01B0\u1EE3ng \xE1nh s\xE1ng th\xE0nh \u0111i\u1EC7n n\u0103ng nh\u01B0 th\u1EBF n\xE0o?"', keywords: "\u1EE9ng d\u1EE5ng, c\xF4ng ngh\u1EC7, k\u1EF9 thu\u1EADt, thi\u1EBFt b\u1ECB, m\xE1y m\xF3c, ho\u1EA1t \u0111\u1ED9ng, nguy\xEAn l\xFD, ch\u1EBF t\u1EA1o" },
|
|
102395
|
+
{ shortContextId: "E", contextId: "EXP_INV", contextDescription: "Th\xED nghi\u1EC7m/\u0110i\u1EC1u tra Khoa h\u1ECDc", contextExample: '"Thi\u1EBFt k\u1EBF th\xED nghi\u1EC7m ch\u1EE9ng minh \u0111\u1ECBnh lu\u1EADt b\u1EA3o to\xE0n n\u0103ng l\u01B0\u1EE3ng." ho\u1EB7c "Ph\xE2n t\xEDch k\u1EBFt qu\u1EA3 th\xED nghi\u1EC7m v\u1EC1 t\u1ED1c \u0111\u1ED9 ph\u1EA3n \u1EE9ng."', keywords: "th\xED nghi\u1EC7m, \u0111i\u1EC1u tra, khoa h\u1ECDc, thi\u1EBFt k\u1EBF, quy tr\xECnh, k\u1EBFt qu\u1EA3, ph\xE2n t\xEDch, d\u1EEF li\u1EC7u" },
|
|
102396
|
+
{ shortContextId: "F", contextId: "REAL_PROB", contextDescription: "V\u1EA5n \u0111\u1EC1 Th\u1EF1c t\u1EBF/X\xE3 h\u1ED9i/M\xF4i tr\u01B0\u1EDDng", contextExample: '"\u0110\u1EC1 xu\u1EA5t gi\u1EA3i ph\xE1p gi\u1EA3m thi\u1EC3u \xF4 nhi\u1EC5m kh\xF4ng kh\xED t\u1EA1i \u0111\xF4 th\u1ECB." ho\u1EB7c "Ph\xE2n t\xEDch \u1EA3nh h\u01B0\u1EDFng c\u1EE7a bi\u1EBFn \u0111\u1ED5i kh\xED h\u1EADu \u0111\u1EBFn n\xF4ng nghi\u1EC7p."', keywords: "v\u1EA5n \u0111\u1EC1, th\u1EF1c t\u1EBF, x\xE3 h\u1ED9i, m\xF4i tr\u01B0\u1EDDng, gi\u1EA3i ph\xE1p, ph\xE2n t\xEDch, \u1EA3nh h\u01B0\u1EDFng, b\u1EC1n v\u1EEFng" },
|
|
102397
|
+
{ shortContextId: "G", contextId: "DATA_MOD", contextDescription: "Di\u1EC5n gi\u1EA3i D\u1EEF li\u1EC7u/M\xF4 h\xECnh h\xF3a", contextExample: '"D\u1EF1a v\xE0o bi\u1EC3u \u0111\u1ED3, nh\u1EADn x\xE9t xu h\u01B0\u1EDBng nhi\u1EC7t \u0111\u1ED9 to\xE0n c\u1EA7u." ho\u1EB7c "X\xE2y d\u1EF1ng m\xF4 h\xECnh to\xE1n h\u1ECDc m\xF4 t\u1EA3 s\u1EF1 t\u0103ng tr\u01B0\u1EDFng d\xE2n s\u1ED1."', keywords: "d\u1EEF li\u1EC7u, bi\u1EC3u \u0111\u1ED3, b\u1EA3ng s\u1ED1 li\u1EC7u, m\xF4 h\xECnh, di\u1EC5n gi\u1EA3i, ph\xE2n t\xEDch, xu h\u01B0\u1EDBng, d\u1EF1 \u0111o\xE1n" },
|
|
102398
|
+
{ shortContextId: "H", contextId: "HIST_SCI", contextDescription: "L\u1ECBch s\u1EED/Ph\xE1t tri\u1EC3n Khoa h\u1ECDc", contextExample: '"Tr\xECnh b\xE0y b\u1ED1i c\u1EA3nh ra \u0111\u1EDDi thuy\u1EBFt t\u01B0\u01A1ng \u0111\u1ED1i c\u1EE7a Einstein." ho\u1EB7c "Ai l\xE0 ng\u01B0\u1EDDi \u0111\u1EA7u ti\xEAn ph\xE1t hi\u1EC7n ra c\u1EA5u tr\xFAc DNA?"', keywords: "l\u1ECBch s\u1EED, ph\xE1t tri\u1EC3n, khoa h\u1ECDc, nh\xE0 khoa h\u1ECDc, ph\xE1t minh, kh\xE1m ph\xE1, b\u1ED1i c\u1EA3nh" },
|
|
102399
|
+
{ shortContextId: "I", contextId: "INTERDISC", contextDescription: "Li\xEAn ng\xE0nh (Interdisciplinary)", contextExample: '"S\u1EED d\u1EE5ng ki\u1EBFn th\u1EE9c To\xE1n v\xE0 V\u1EADt l\xFD \u0111\u1EC3 t\xEDnh qu\u1EF9 \u0111\u1EA1o c\u1EE7a v\u1EADt n\xE9m xi\xEAn." ho\u1EB7c "Ph\xE2n t\xEDch c\u01A1 ch\u1EBF h\xF3a sinh c\u1EE7a qu\xE1 tr\xECnh ti\xEAu h\xF3a."', keywords: "li\xEAn ng\xE0nh, t\xEDch h\u1EE3p, To\xE1n-L\xFD, Sinh-H\xF3a, Khoa h\u1ECDc-C\xF4ng ngh\u1EC7, k\u1EBFt n\u1ED1i ki\u1EBFn th\u1EE9c" },
|
|
102400
|
+
{ shortContextId: "J", contextId: "HYPO_COMP", contextDescription: "Gi\u1EA3 \u0111\u1ECBnh/So s\xE1nh T\xECnh hu\u1ED1ng", contextExample: '"N\u1EBFu Tr\xE1i \u0110\u1EA5t kh\xF4ng c\xF3 t\u1EEB tr\u01B0\u1EDDng th\xEC \u0111i\u1EC1u g\xEC s\u1EBD x\u1EA3y ra?" ho\u1EB7c "So s\xE1nh \u01B0u nh\u01B0\u1EE3c \u0111i\u1EC3m c\u1EE7a n\u0103ng l\u01B0\u1EE3ng h\u1EA1t nh\xE2n v\xE0 n\u0103ng l\u01B0\u1EE3ng m\u1EB7t tr\u1EDDi."', keywords: "gi\u1EA3 \u0111\u1ECBnh, so s\xE1nh, t\xECnh hu\u1ED1ng, n\u1EBFu...th\xEC, \u01B0u \u0111i\u1EC3m, nh\u01B0\u1EE3c \u0111i\u1EC3m, ph\xE2n t\xEDch, \u0111\xE1nh gi\xE1" },
|
|
102401
|
+
{ shortContextId: "__custom__", contextId: "__custom__", contextDescription: "Other (Custom Input)", contextExample: "", keywords: "custom, other, specific" }
|
|
102402
|
+
];
|
|
102403
|
+
|
|
102492
102404
|
// src/react-ui/components/authoring/AIFullQuizGeneratorModal.tsx
|
|
102493
102405
|
var availableQuestionTypesForFullQuiz = [
|
|
102494
102406
|
{ value: "true_false", label: "True/False" },
|
package/dist/react-ui.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { Q as QuizResultType, U as UserAnswerType, n as PracticeSession, o as Pr
|
|
|
5
5
|
export { j as AchievementDefinition, r as ActivityCalendarData, u as AnalysisReport, A as AnswerDetail, x as ChatContext, C as ChatMessage, v as DashboardCardConfig, D as DashboardCardId, w as DashboardLayout, y as Goal, G as GoalType, t as ImageContextItem, I as ImportError, K as KnowledgeCard, L as LearningAnalysis, e as PerformanceByBloomLevel, b as PerformanceByCategory, d as PerformanceByDifficulty, P as PerformanceByLearningObjective, c as PerformanceByTopic, f as PerformanceMetric, s as PerformanceSummary, k as PracticeDifficulty, q as PracticeTopicSummary, g as QuestionReview, R as RoadmapItem, T as TestCaseResult, a as UserAnswers, W as WeeklyRoadmap } from './ai-ecosystem-DqFRlFU3.cjs';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { ReactNode } from 'react';
|
|
8
|
-
export { c as AIFullQuizGeneratorModal, A as AIQuestionGeneratorModal, e as APIKeyManagerModal, f as ApiKeySettings, m as ApproachManager, B as BloomLevelManager, C as CategoryManager, l as ContextManager, E as EditQuestionModal, G as GradeLevelManager, I as ImportQuestionsModal, L as LearningObjectiveManager, M as MetadataTabs, h as QuestionFilters, i as QuestionFormDialog, g as QuestionList, a as QuestionPreviewModal, k as QuestionTypeManager, Q as QuizAuthoringTool, b as QuizSettingsForm, d as SCORMExportModal, S as SelectedQuestionsPanel, j as SubjectManager, n as Toaster, T as TopicManager, t as toast, u as useToast } from './toaster-
|
|
8
|
+
export { c as AIFullQuizGeneratorModal, A as AIQuestionGeneratorModal, e as APIKeyManagerModal, f as ApiKeySettings, m as ApproachManager, B as BloomLevelManager, C as CategoryManager, l as ContextManager, E as EditQuestionModal, G as GradeLevelManager, I as ImportQuestionsModal, L as LearningObjectiveManager, M as MetadataTabs, h as QuestionFilters, i as QuestionFormDialog, g as QuestionList, a as QuestionPreviewModal, k as QuestionTypeManager, Q as QuizAuthoringTool, b as QuizSettingsForm, d as SCORMExportModal, S as SelectedQuestionsPanel, j as SubjectManager, n as Toaster, T as TopicManager, t as toast, u as useToast } from './toaster-CKS4zoRY.cjs';
|
|
9
9
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
10
10
|
import { VariantProps } from 'class-variance-authority';
|
|
11
11
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
package/dist/react-ui.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Q as QuizResultType, U as UserAnswerType, n as PracticeSession, o as Pr
|
|
|
5
5
|
export { j as AchievementDefinition, r as ActivityCalendarData, u as AnalysisReport, A as AnswerDetail, x as ChatContext, C as ChatMessage, v as DashboardCardConfig, D as DashboardCardId, w as DashboardLayout, y as Goal, G as GoalType, t as ImageContextItem, I as ImportError, K as KnowledgeCard, L as LearningAnalysis, e as PerformanceByBloomLevel, b as PerformanceByCategory, d as PerformanceByDifficulty, P as PerformanceByLearningObjective, c as PerformanceByTopic, f as PerformanceMetric, s as PerformanceSummary, k as PracticeDifficulty, q as PracticeTopicSummary, g as QuestionReview, R as RoadmapItem, T as TestCaseResult, a as UserAnswers, W as WeeklyRoadmap } from './ai-ecosystem-DqVlSO3r.js';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { ReactNode } from 'react';
|
|
8
|
-
export { c as AIFullQuizGeneratorModal, A as AIQuestionGeneratorModal, e as APIKeyManagerModal, f as ApiKeySettings, m as ApproachManager, B as BloomLevelManager, C as CategoryManager, l as ContextManager, E as EditQuestionModal, G as GradeLevelManager, I as ImportQuestionsModal, L as LearningObjectiveManager, M as MetadataTabs, h as QuestionFilters, i as QuestionFormDialog, g as QuestionList, a as QuestionPreviewModal, k as QuestionTypeManager, Q as QuizAuthoringTool, b as QuizSettingsForm, d as SCORMExportModal, S as SelectedQuestionsPanel, j as SubjectManager, n as Toaster, T as TopicManager, t as toast, u as useToast } from './toaster-
|
|
8
|
+
export { c as AIFullQuizGeneratorModal, A as AIQuestionGeneratorModal, e as APIKeyManagerModal, f as ApiKeySettings, m as ApproachManager, B as BloomLevelManager, C as CategoryManager, l as ContextManager, E as EditQuestionModal, G as GradeLevelManager, I as ImportQuestionsModal, L as LearningObjectiveManager, M as MetadataTabs, h as QuestionFilters, i as QuestionFormDialog, g as QuestionList, a as QuestionPreviewModal, k as QuestionTypeManager, Q as QuizAuthoringTool, b as QuizSettingsForm, d as SCORMExportModal, S as SelectedQuestionsPanel, j as SubjectManager, n as Toaster, T as TopicManager, t as toast, u as useToast } from './toaster-DLJ_2W9u.js';
|
|
9
9
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
10
10
|
import { VariantProps } from 'class-variance-authority';
|
|
11
11
|
import * as LabelPrimitive from '@radix-ui/react-label';
|