@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.mjs
CHANGED
|
@@ -99618,7 +99618,8 @@ var QuizContextSchema = z.object({
|
|
|
99618
99618
|
originalSubject: z.string().optional(),
|
|
99619
99619
|
originalCategory: z.string().optional(),
|
|
99620
99620
|
originalTopic: z.string().optional(),
|
|
99621
|
-
loDescription: z.string().optional().describe("The full description of the learning objective for deep context.")
|
|
99621
|
+
loDescription: z.string().optional().describe("The full description of the learning objective for deep context."),
|
|
99622
|
+
gradeBand: z.string().optional()
|
|
99622
99623
|
});
|
|
99623
99624
|
var BaseQuestionGenerationClientInputSchema = z.object({
|
|
99624
99625
|
language: z.string().optional().default("English"),
|
|
@@ -101169,189 +101170,122 @@ var supportedQuestionTypesForAI = [
|
|
|
101169
101170
|
{ value: "sequence", label: "Sequence" },
|
|
101170
101171
|
{ value: "matching", label: "Matching" }
|
|
101171
101172
|
];
|
|
101172
|
-
var contextOptions = [
|
|
101173
|
-
{ 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" },
|
|
101174
|
-
{ 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" },
|
|
101175
|
-
{ 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" },
|
|
101176
|
-
{ 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" },
|
|
101177
|
-
{ 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" },
|
|
101178
|
-
{ 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" },
|
|
101179
|
-
{ 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" },
|
|
101180
|
-
{ 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" },
|
|
101181
|
-
{ 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" },
|
|
101182
|
-
{ 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" },
|
|
101183
|
-
{ shortContextId: "__custom__", contextId: "__custom__", contextDescription: "Other (Custom Input)", contextExample: "", keywords: "custom, other, specific" }
|
|
101184
|
-
];
|
|
101185
|
-
var bloomLevelOptions = [
|
|
101186
|
-
{ value: "remembering", label: "Nh\u1EDB - D\u1EC5 (Remembering)" },
|
|
101187
|
-
{ value: "understanding", label: "Hi\u1EC3u - Trung B\xECnh (Understanding)" },
|
|
101188
|
-
{ value: "applying", label: "V\u1EADn D\u1EE5ng - Kh\xF3 (Applying)" }
|
|
101189
|
-
];
|
|
101190
|
-
var calculateCombinedDifficulty = (contextId, bloomLevel, qType, customContextInput) => {
|
|
101191
|
-
let contextScore = 1;
|
|
101192
|
-
const selectedContext = contextOptions.find((c4) => c4.contextId === contextId);
|
|
101193
|
-
if (selectedContext) {
|
|
101194
|
-
if (["THEO_ABS", "HIST_SCI", "__none__"].includes(selectedContext.contextId) || selectedContext.contextId === "__custom__" && !customContextInput.trim()) {
|
|
101195
|
-
contextScore = 1;
|
|
101196
|
-
} else if (["SPEC_CASE", "NAT_OBS", "DATA_MOD", "INTERDISC", "HYPO_COMP"].includes(selectedContext.contextId) || selectedContext.contextId === "__custom__" && customContextInput.trim()) {
|
|
101197
|
-
contextScore = 2;
|
|
101198
|
-
} else if (["TECH_ENG", "EXP_INV", "REAL_PROB"].includes(selectedContext.contextId)) {
|
|
101199
|
-
contextScore = 3;
|
|
101200
|
-
}
|
|
101201
|
-
} else if (contextId === "__custom__" && customContextInput.trim()) {
|
|
101202
|
-
contextScore = 2;
|
|
101203
|
-
}
|
|
101204
|
-
let bloomScore = 1;
|
|
101205
|
-
if (bloomLevel === "understanding") bloomScore = 2;
|
|
101206
|
-
else if (bloomLevel === "applying") bloomScore = 3;
|
|
101207
|
-
let questionTypeScore = 1;
|
|
101208
|
-
switch (qType) {
|
|
101209
|
-
case "true_false":
|
|
101210
|
-
case "multiple_choice":
|
|
101211
|
-
case "short_answer":
|
|
101212
|
-
questionTypeScore = 1;
|
|
101213
|
-
break;
|
|
101214
|
-
case "matching":
|
|
101215
|
-
case "fill_in_the_blanks":
|
|
101216
|
-
case "numeric":
|
|
101217
|
-
questionTypeScore = 2;
|
|
101218
|
-
break;
|
|
101219
|
-
case "sequence":
|
|
101220
|
-
case "multiple_response":
|
|
101221
|
-
questionTypeScore = 3;
|
|
101222
|
-
break;
|
|
101223
|
-
default:
|
|
101224
|
-
questionTypeScore = 1;
|
|
101225
|
-
}
|
|
101226
|
-
const totalScore = bloomScore + contextScore + questionTypeScore;
|
|
101227
|
-
if (totalScore <= 4) return "easy";
|
|
101228
|
-
if (totalScore <= 6) return "medium";
|
|
101229
|
-
return "hard";
|
|
101230
|
-
};
|
|
101231
101173
|
var AIQuestionGeneratorModal = ({
|
|
101232
101174
|
isOpen,
|
|
101233
101175
|
onClose,
|
|
101234
101176
|
onQuestionGenerated,
|
|
101235
|
-
language: language3
|
|
101236
|
-
|
|
101177
|
+
language: language3,
|
|
101178
|
+
questionType: questionTypeProp,
|
|
101179
|
+
subjects = [],
|
|
101180
|
+
topics = [],
|
|
101181
|
+
gradeLevels = [],
|
|
101182
|
+
bloomLevels = []
|
|
101237
101183
|
}) => {
|
|
101238
|
-
const [
|
|
101239
|
-
const [selectedContextId, setSelectedContextId] = useState("__none__");
|
|
101240
|
-
const [customContextInput, setCustomContextInput] = useState("");
|
|
101241
|
-
const [questionType, setQuestionType] = useState("multiple_choice");
|
|
101242
|
-
const [selectedBloomLevel, setSelectedBloomLevel] = useState("remembering");
|
|
101184
|
+
const [prompt, setPrompt] = useState("");
|
|
101243
101185
|
const [isLoading, setIsLoading] = useState(false);
|
|
101244
101186
|
const [error, setError] = useState(null);
|
|
101245
|
-
const [computedDifficultyForDisplay, setComputedDifficultyForDisplay] = useState(null);
|
|
101246
101187
|
const { toast: toast2 } = useToast();
|
|
101188
|
+
const [subjectCode, setSubjectCode] = useState("");
|
|
101189
|
+
const [topicCode, setTopicCode] = useState("");
|
|
101190
|
+
const [gradeBand, setGradeBand] = useState("");
|
|
101191
|
+
const [bloomLevelCode, setBloomLevelCode] = useState("");
|
|
101192
|
+
const [selectedQuestionType, setSelectedQuestionType] = useState("multiple_choice");
|
|
101247
101193
|
const [numberOfOptions, setNumberOfOptions] = useState(4);
|
|
101248
|
-
const [minCorrectAnswers, setMinCorrectAnswers] = useState(
|
|
101249
|
-
const [maxCorrectAnswers, setMaxCorrectAnswers] = useState(
|
|
101194
|
+
const [minCorrectAnswers, setMinCorrectAnswers] = useState(2);
|
|
101195
|
+
const [maxCorrectAnswers, setMaxCorrectAnswers] = useState(3);
|
|
101250
101196
|
const [isCaseSensitive, setIsCaseSensitive] = useState(false);
|
|
101251
101197
|
const [numberOfBlanks, setNumberOfBlanks] = useState(2);
|
|
101252
101198
|
const [numberOfSequenceItems, setNumberOfSequenceItems] = useState(4);
|
|
101253
101199
|
const [numberOfMatchingPairs, setNumberOfMatchingPairs] = useState(4);
|
|
101254
101200
|
const [isApiKeyManagerModalOpen, setIsApiKeyManagerModalOpen] = useState(false);
|
|
101255
101201
|
const [geminiApiKeyExists, setGeminiApiKeyExists] = useState(false);
|
|
101202
|
+
const finalQuestionType = questionTypeProp || selectedQuestionType;
|
|
101256
101203
|
useEffect(() => {
|
|
101257
101204
|
if (isOpen) {
|
|
101258
|
-
|
|
101259
|
-
setSelectedContextId("__none__");
|
|
101260
|
-
setCustomContextInput("");
|
|
101261
|
-
setQuestionType("multiple_choice");
|
|
101262
|
-
setSelectedBloomLevel("remembering");
|
|
101205
|
+
setPrompt("");
|
|
101263
101206
|
setError(null);
|
|
101264
101207
|
setIsLoading(false);
|
|
101265
|
-
|
|
101266
|
-
|
|
101267
|
-
|
|
101268
|
-
|
|
101269
|
-
|
|
101270
|
-
setNumberOfSequenceItems(4);
|
|
101271
|
-
setNumberOfMatchingPairs(4);
|
|
101272
|
-
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
101273
|
-
}
|
|
101274
|
-
}, [isOpen]);
|
|
101275
|
-
useEffect(() => {
|
|
101276
|
-
if (isOpen) {
|
|
101277
|
-
const difficulty = calculateCombinedDifficulty(selectedContextId, selectedBloomLevel, questionType, customContextInput);
|
|
101278
|
-
setComputedDifficultyForDisplay(difficulty);
|
|
101208
|
+
setSubjectCode("");
|
|
101209
|
+
setTopicCode("");
|
|
101210
|
+
setGradeBand("");
|
|
101211
|
+
setBloomLevelCode("");
|
|
101212
|
+
setSelectedQuestionType(questionTypeProp || "multiple_choice");
|
|
101279
101213
|
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
101280
101214
|
}
|
|
101281
|
-
}, [
|
|
101215
|
+
}, [isOpen, questionTypeProp]);
|
|
101216
|
+
const filteredTopics = useMemo(() => {
|
|
101217
|
+
if (!subjectCode) return [];
|
|
101218
|
+
return topics.filter((t4) => t4.subjectCode === subjectCode);
|
|
101219
|
+
}, [subjectCode, topics]);
|
|
101282
101220
|
const handleApiKeyModalClose = () => {
|
|
101283
101221
|
setIsApiKeyManagerModalOpen(false);
|
|
101284
101222
|
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
101285
101223
|
};
|
|
101286
101224
|
const handleSubmit = async () => {
|
|
101287
|
-
if (!
|
|
101288
|
-
setError("Please provide a
|
|
101225
|
+
if (!prompt.trim()) {
|
|
101226
|
+
setError("Please provide a prompt for the question.");
|
|
101289
101227
|
return;
|
|
101290
101228
|
}
|
|
101291
101229
|
const geminiKey = APIKeyService.getAPIKey(GEMINI_API_KEY_SERVICE_NAME);
|
|
101292
101230
|
if (!geminiKey) {
|
|
101293
|
-
setError("Gemini API Key is not set. Please
|
|
101231
|
+
setError("Gemini API Key is not set. Please configure it.");
|
|
101294
101232
|
setGeminiApiKeyExists(false);
|
|
101295
101233
|
return;
|
|
101296
101234
|
}
|
|
101297
101235
|
setGeminiApiKeyExists(true);
|
|
101298
101236
|
setError(null);
|
|
101299
101237
|
setIsLoading(true);
|
|
101300
|
-
let contextDescriptionForAI = void 0;
|
|
101301
|
-
if (selectedContextId === "__custom__") {
|
|
101302
|
-
contextDescriptionForAI = customContextInput.trim() || void 0;
|
|
101303
|
-
} else if (selectedContextId && selectedContextId !== "__none__") {
|
|
101304
|
-
const selectedContextObj = contextOptions.find((c4) => c4.contextId === selectedContextId);
|
|
101305
|
-
contextDescriptionForAI = selectedContextObj?.contextDescription;
|
|
101306
|
-
}
|
|
101307
|
-
const finalDifficultyForAI = calculateCombinedDifficulty(selectedContextId, selectedBloomLevel, questionType, customContextInput);
|
|
101308
101238
|
try {
|
|
101309
|
-
|
|
101239
|
+
const quizContext = {
|
|
101240
|
+
plannedTopic: prompt,
|
|
101241
|
+
originalSubject: subjectCode,
|
|
101242
|
+
originalTopic: topicCode,
|
|
101243
|
+
gradeBand,
|
|
101244
|
+
plannedBloomLevel: bloomLevelCode
|
|
101245
|
+
};
|
|
101310
101246
|
const baseClientInput = {
|
|
101311
|
-
topic,
|
|
101312
101247
|
language: language3,
|
|
101313
|
-
|
|
101314
|
-
|
|
101315
|
-
contextDescription: contextDescriptionForAI,
|
|
101316
|
-
selectedContextId: selectedContextId !== "__none__" && selectedContextId !== "__custom__" ? selectedContextId : selectedContextId === "__custom__" && customContextInput.trim() ? "__custom__" : void 0
|
|
101248
|
+
difficulty: "medium",
|
|
101249
|
+
quizContext
|
|
101317
101250
|
};
|
|
101318
|
-
|
|
101251
|
+
let generatedResult = {};
|
|
101252
|
+
switch (finalQuestionType) {
|
|
101319
101253
|
case "true_false":
|
|
101320
|
-
|
|
101254
|
+
generatedResult = await generateTrueFalseQuestion(baseClientInput, geminiKey);
|
|
101321
101255
|
break;
|
|
101322
101256
|
case "multiple_choice":
|
|
101323
|
-
|
|
101257
|
+
generatedResult = await generateMCQQuestion({ ...baseClientInput, numberOfOptions }, geminiKey);
|
|
101324
101258
|
break;
|
|
101325
101259
|
case "multiple_response":
|
|
101326
|
-
|
|
101327
|
-
throw new Error("Invalid settings for Multiple Response correct answers count or number of options.");
|
|
101328
|
-
}
|
|
101329
|
-
generatedQuestionData = await generateMRQQuestion({ ...baseClientInput, numberOfOptions, minCorrectAnswers, maxCorrectAnswers }, geminiKey);
|
|
101260
|
+
generatedResult = await generateMRQQuestion({ ...baseClientInput, numberOfOptions, minCorrectAnswers, maxCorrectAnswers }, geminiKey);
|
|
101330
101261
|
break;
|
|
101331
101262
|
case "short_answer":
|
|
101332
|
-
|
|
101263
|
+
generatedResult = await generateShortAnswerQuestion({ ...baseClientInput, isCaseSensitive }, geminiKey);
|
|
101333
101264
|
break;
|
|
101334
101265
|
case "numeric":
|
|
101335
|
-
|
|
101266
|
+
generatedResult = await generateNumericQuestion({ ...baseClientInput, allowDecimals: true, tolerance: 0 }, geminiKey);
|
|
101336
101267
|
break;
|
|
101337
101268
|
case "fill_in_the_blanks":
|
|
101338
|
-
|
|
101269
|
+
generatedResult = await generateFillInTheBlanksQuestion({ ...baseClientInput, numberOfBlanks, isCaseSensitive }, geminiKey);
|
|
101339
101270
|
break;
|
|
101340
101271
|
case "sequence":
|
|
101341
|
-
|
|
101272
|
+
generatedResult = await generateSequenceQuestion({ ...baseClientInput, numberOfItems: numberOfSequenceItems }, geminiKey);
|
|
101342
101273
|
break;
|
|
101343
101274
|
case "matching":
|
|
101344
|
-
|
|
101275
|
+
generatedResult = await generateMatchingQuestion({ ...baseClientInput, numberOfPairs: numberOfMatchingPairs, shuffleOptions: true }, geminiKey);
|
|
101345
101276
|
break;
|
|
101346
101277
|
default:
|
|
101347
|
-
|
|
101348
|
-
|
|
101349
|
-
|
|
101350
|
-
|
|
101351
|
-
|
|
101352
|
-
|
|
101353
|
-
completeQuestion
|
|
101354
|
-
completeQuestion.
|
|
101278
|
+
throw new Error(`AI generation for '${finalQuestionType}' is not implemented in this flow.`);
|
|
101279
|
+
}
|
|
101280
|
+
if (generatedResult.error) {
|
|
101281
|
+
throw new Error(generatedResult.error);
|
|
101282
|
+
}
|
|
101283
|
+
if (generatedResult.question) {
|
|
101284
|
+
const completeQuestion = generatedResult.question;
|
|
101285
|
+
completeQuestion.subject = subjectCode;
|
|
101286
|
+
completeQuestion.topic = topicCode;
|
|
101287
|
+
completeQuestion.gradeBand = gradeBand;
|
|
101288
|
+
completeQuestion.bloomLevel = bloomLevelCode;
|
|
101355
101289
|
if (completeQuestion.points === void 0) completeQuestion.points = 10;
|
|
101356
101290
|
onQuestionGenerated(completeQuestion);
|
|
101357
101291
|
toast2({ title: "AI Question Generated", description: "Review and edit the generated question." });
|
|
@@ -101361,9 +101295,9 @@ var AIQuestionGeneratorModal = ({
|
|
|
101361
101295
|
}
|
|
101362
101296
|
} catch (e3) {
|
|
101363
101297
|
console.error("AI Question Generation Error:", e3);
|
|
101364
|
-
let errorMessage = e3.message || "An unknown error occurred
|
|
101365
|
-
if (typeof errorMessage === "string" &&
|
|
101366
|
-
errorMessage = "The provided Google Gemini API Key is invalid
|
|
101298
|
+
let errorMessage = e3.message || "An unknown error occurred.";
|
|
101299
|
+
if (typeof errorMessage === "string" && errorMessage.includes("API key not valid")) {
|
|
101300
|
+
errorMessage = "The provided Google Gemini API Key is invalid. Please check it.";
|
|
101367
101301
|
setGeminiApiKeyExists(false);
|
|
101368
101302
|
}
|
|
101369
101303
|
setError(errorMessage);
|
|
@@ -101372,11 +101306,17 @@ var AIQuestionGeneratorModal = ({
|
|
|
101372
101306
|
setIsLoading(false);
|
|
101373
101307
|
}
|
|
101374
101308
|
};
|
|
101309
|
+
const comboboxOptions = {
|
|
101310
|
+
subjects: subjects.map((s4) => ({ value: s4.code, label: s4.name })),
|
|
101311
|
+
topics: filteredTopics.map((t4) => ({ value: t4.code, label: t4.name })),
|
|
101312
|
+
gradeLevels: gradeLevels.map((g) => ({ value: g.code, label: g.name })),
|
|
101313
|
+
bloomLevels: bloomLevels.map((b2) => ({ value: b2.code, label: b2.name }))
|
|
101314
|
+
};
|
|
101375
101315
|
const renderSpecificParams = () => {
|
|
101376
|
-
switch (
|
|
101316
|
+
switch (finalQuestionType) {
|
|
101377
101317
|
case "multiple_choice":
|
|
101378
101318
|
case "multiple_response":
|
|
101379
|
-
return /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-options" }, "Number of Options (2-
|
|
101319
|
+
return /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2 pt-4 border-t" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-options" }, "Number of Options (2-8)"), /* @__PURE__ */ React169__default.createElement(
|
|
101380
101320
|
Input,
|
|
101381
101321
|
{
|
|
101382
101322
|
id: "ai-num-options",
|
|
@@ -101384,76 +101324,32 @@ var AIQuestionGeneratorModal = ({
|
|
|
101384
101324
|
value: numberOfOptions,
|
|
101385
101325
|
onChange: (e3) => setNumberOfOptions(parseInt(e3.target.value, 10)),
|
|
101386
101326
|
min: 2,
|
|
101387
|
-
max:
|
|
101327
|
+
max: 8
|
|
101388
101328
|
}
|
|
101389
|
-
),
|
|
101329
|
+
), finalQuestionType === "multiple_response" && /* @__PURE__ */ React169__default.createElement(React169__default.Fragment, null, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-min-correct" }, "Min Correct Answers"), /* @__PURE__ */ React169__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__default.createElement(Label2, { htmlFor: "ai-max-correct" }, "Max Correct Answers"), /* @__PURE__ */ React169__default.createElement(Input, { id: "ai-max-correct", type: "number", value: maxCorrectAnswers, onChange: (e3) => setMaxCorrectAnswers(parseInt(e3.target.value, 10)), min: minCorrectAnswers, max: numberOfOptions })));
|
|
101390
101330
|
case "short_answer":
|
|
101391
101331
|
case "fill_in_the_blanks":
|
|
101392
|
-
return /* @__PURE__ */ React169__default.createElement("div", { className: "flex items-center space-x-2" }, /* @__PURE__ */ React169__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__default.createElement(Label2, { htmlFor: "ai-case-sensitive" }, "Case Sensitive Answers"),
|
|
101332
|
+
return /* @__PURE__ */ React169__default.createElement("div", { className: "flex items-center space-x-2 pt-4 border-t" }, /* @__PURE__ */ React169__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__default.createElement(Label2, { htmlFor: "ai-case-sensitive" }, "Case Sensitive Answers"), finalQuestionType === "fill_in_the_blanks" && /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-1 ml-4" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-blanks" }, "Number of Blanks (1-5)"), /* @__PURE__ */ React169__default.createElement(Input, { id: "ai-num-blanks", type: "number", value: numberOfBlanks, onChange: (e3) => setNumberOfBlanks(parseInt(e3.target.value, 10)), min: 1, max: 5 })));
|
|
101393
101333
|
case "sequence":
|
|
101394
|
-
return /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-seq-items" }, "Number of Items to Sequence (2-10)"), /* @__PURE__ */ React169__default.createElement(Input, { id: "ai-num-seq-items", type: "number", value: numberOfSequenceItems, onChange: (e3) => setNumberOfSequenceItems(parseInt(e3.target.value, 10)), min: 2, max: 10 }));
|
|
101334
|
+
return /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2 pt-4 border-t" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-seq-items" }, "Number of Items to Sequence (2-10)"), /* @__PURE__ */ React169__default.createElement(Input, { id: "ai-num-seq-items", type: "number", value: numberOfSequenceItems, onChange: (e3) => setNumberOfSequenceItems(parseInt(e3.target.value, 10)), min: 2, max: 10 }));
|
|
101395
101335
|
case "matching":
|
|
101396
|
-
return /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-match-pairs" }, "Number of Pairs to Match (2-8)"), /* @__PURE__ */ React169__default.createElement(Input, { id: "ai-num-match-pairs", type: "number", value: numberOfMatchingPairs, onChange: (e3) => setNumberOfMatchingPairs(parseInt(e3.target.value, 10)), min: 2, max: 8 }));
|
|
101336
|
+
return /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2 pt-4 border-t" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-num-match-pairs" }, "Number of Pairs to Match (2-8)"), /* @__PURE__ */ React169__default.createElement(Input, { id: "ai-num-match-pairs", type: "number", value: numberOfMatchingPairs, onChange: (e3) => setNumberOfMatchingPairs(parseInt(e3.target.value, 10)), min: 2, max: 8 }));
|
|
101397
101337
|
default:
|
|
101398
101338
|
return null;
|
|
101399
101339
|
}
|
|
101400
101340
|
};
|
|
101401
101341
|
return /* @__PURE__ */ React169__default.createElement(React169__default.Fragment, null, /* @__PURE__ */ React169__default.createElement(Dialog2, { open: isOpen, onOpenChange: (open) => {
|
|
101402
101342
|
if (!open) onClose();
|
|
101403
|
-
} }, /* @__PURE__ */ React169__default.createElement(DialogContent2, { className: "sm:max-w-[
|
|
101404
|
-
Button,
|
|
101405
|
-
{
|
|
101406
|
-
variant: "link",
|
|
101407
|
-
className: "p-0 h-auto text-xs text-amber-700 hover:text-amber-800 mt-1",
|
|
101408
|
-
onClick: () => {
|
|
101409
|
-
onClose();
|
|
101410
|
-
setIsApiKeyManagerModalOpen(true);
|
|
101411
|
-
}
|
|
101412
|
-
},
|
|
101413
|
-
"Set API Key Now"
|
|
101414
|
-
)))), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-topic" }, "Topic"), /* @__PURE__ */ React169__default.createElement(
|
|
101343
|
+
} }, /* @__PURE__ */ React169__default.createElement(DialogContent2, { className: "sm:max-w-[600px]" }, /* @__PURE__ */ React169__default.createElement(DialogHeader, null, /* @__PURE__ */ React169__default.createElement(DialogTitle2, { className: "flex items-center font-headline text-2xl" }, /* @__PURE__ */ React169__default.createElement(WandSparkles, { className: "mr-2 h-6 w-6 text-primary" }), " AI Question Generator"), /* @__PURE__ */ React169__default.createElement(DialogDescription2, null, "Provide a prompt and metadata to generate a '", finalQuestionType, "' question.")), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-4 py-4 max-h-[60vh] overflow-y-auto px-2" }, !geminiApiKeyExists && /* @__PURE__ */ React169__default.createElement("div", { className: "p-3 mb-4 border border-amber-500 bg-amber-50 rounded-md text-amber-700" }), !questionTypeProp && /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-q-type-select" }, "Question Type"), /* @__PURE__ */ React169__default.createElement(Select2, { value: selectedQuestionType, onValueChange: (v) => setSelectedQuestionType(v) }, /* @__PURE__ */ React169__default.createElement(SelectTrigger2, { id: "ai-q-type-select" }, /* @__PURE__ */ React169__default.createElement(SelectValue2, null)), /* @__PURE__ */ React169__default.createElement(SelectContent2, null, supportedQuestionTypesForAI.map((type) => /* @__PURE__ */ React169__default.createElement(SelectItem2, { key: type.value, value: type.value }, type.label))))), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-prompt" }, "Prompt / Topic"), /* @__PURE__ */ React169__default.createElement(
|
|
101415
101344
|
Textarea,
|
|
101416
101345
|
{
|
|
101417
|
-
id: "ai-
|
|
101418
|
-
value:
|
|
101419
|
-
onChange: (e3) =>
|
|
101420
|
-
placeholder: "e.g.,
|
|
101421
|
-
className: "min-h-[
|
|
101346
|
+
id: "ai-prompt",
|
|
101347
|
+
value: prompt,
|
|
101348
|
+
onChange: (e3) => setPrompt(e3.target.value),
|
|
101349
|
+
placeholder: "e.g., The process of photosynthesis, The causes of World War II, Basic Algebra Equations",
|
|
101350
|
+
className: "min-h-[100px]"
|
|
101422
101351
|
}
|
|
101423
|
-
)), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, {
|
|
101424
|
-
Select2,
|
|
101425
|
-
{
|
|
101426
|
-
value: selectedContextId,
|
|
101427
|
-
onValueChange: (value) => setSelectedContextId(value)
|
|
101428
|
-
},
|
|
101429
|
-
/* @__PURE__ */ React169__default.createElement(SelectTrigger2, { id: "ai-context-select" }, /* @__PURE__ */ React169__default.createElement(SelectValue2, { placeholder: "Select a context or choose 'Other'..." })),
|
|
101430
|
-
/* @__PURE__ */ React169__default.createElement(SelectContent2, null, /* @__PURE__ */ React169__default.createElement(SelectItem2, { value: "__none__" }, "None (General Topic)"), contextOptions.map((opt) => /* @__PURE__ */ React169__default.createElement(SelectItem2, { key: opt.contextId, value: opt.contextId }, opt.contextDescription, " ", opt.shortContextId !== "__custom__" ? `(${opt.shortContextId})` : "")))
|
|
101431
|
-
)), selectedContextId === "__custom__" && /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-custom-context" }, "Custom Context"), /* @__PURE__ */ React169__default.createElement(
|
|
101432
|
-
Textarea,
|
|
101433
|
-
{
|
|
101434
|
-
id: "ai-custom-context",
|
|
101435
|
-
value: customContextInput,
|
|
101436
|
-
onChange: (e3) => setCustomContextInput(e3.target.value),
|
|
101437
|
-
placeholder: "Enter your specific context here...",
|
|
101438
|
-
className: "min-h-[60px]"
|
|
101439
|
-
}
|
|
101440
|
-
)), /* @__PURE__ */ React169__default.createElement("div", { className: "grid grid-cols-2 gap-4" }, /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-question-type" }, "Question Type"), /* @__PURE__ */ React169__default.createElement(
|
|
101441
|
-
Select2,
|
|
101442
|
-
{
|
|
101443
|
-
value: questionType,
|
|
101444
|
-
onValueChange: (value) => setQuestionType(value)
|
|
101445
|
-
},
|
|
101446
|
-
/* @__PURE__ */ React169__default.createElement(SelectTrigger2, { id: "ai-question-type" }, /* @__PURE__ */ React169__default.createElement(SelectValue2, { placeholder: "Select question type" })),
|
|
101447
|
-
/* @__PURE__ */ React169__default.createElement(SelectContent2, null, supportedQuestionTypesForAI.map((qType) => /* @__PURE__ */ React169__default.createElement(SelectItem2, { key: qType.value, value: qType.value }, qType.label)))
|
|
101448
|
-
)), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, { htmlFor: "ai-bloom-level" }, "Bloom Level"), /* @__PURE__ */ React169__default.createElement(
|
|
101449
|
-
Select2,
|
|
101450
|
-
{
|
|
101451
|
-
value: selectedBloomLevel,
|
|
101452
|
-
onValueChange: (value) => setSelectedBloomLevel(value)
|
|
101453
|
-
},
|
|
101454
|
-
/* @__PURE__ */ React169__default.createElement(SelectTrigger2, { id: "ai-bloom-level" }, /* @__PURE__ */ React169__default.createElement(SelectValue2, { placeholder: "Select Bloom Level" })),
|
|
101455
|
-
/* @__PURE__ */ React169__default.createElement(SelectContent2, null, bloomLevelOptions.map((level) => /* @__PURE__ */ React169__default.createElement(SelectItem2, { key: level.value, value: level.value }, level.label)))
|
|
101456
|
-
))), renderSpecificParams(), computedDifficultyForDisplay && /* @__PURE__ */ React169__default.createElement("div", { className: "mt-3 p-3 border rounded-md bg-secondary/50" }, /* @__PURE__ */ React169__default.createElement("p", { className: "text-sm font-medium text-foreground" }, "Calculated AI Difficulty: ", /* @__PURE__ */ React169__default.createElement("span", { className: "font-bold text-primary capitalize" }, computedDifficultyForDisplay))), error && /* @__PURE__ */ React169__default.createElement("p", { className: "text-sm text-destructive flex items-center mt-2" }, /* @__PURE__ */ React169__default.createElement(TriangleAlert, { className: "mr-1 h-4 w-4" }), " ", error)), /* @__PURE__ */ React169__default.createElement(DialogFooter, null, /* @__PURE__ */ React169__default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React169__default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React169__default.createElement(Button, { type: "button", onClick: handleSubmit, disabled: isLoading || !topic.trim() || !geminiApiKeyExists }, isLoading ? /* @__PURE__ */ React169__default.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React169__default.createElement(WandSparkles, { className: "mr-2 h-4 w-4" }), "Generate Question")))), /* @__PURE__ */ React169__default.createElement(APIKeyManagerModal, { isOpen: isApiKeyManagerModalOpen, onClose: handleApiKeyModalClose }));
|
|
101352
|
+
)), /* @__PURE__ */ React169__default.createElement("div", { className: "grid grid-cols-2 gap-4" }, /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, null, "Subject"), /* @__PURE__ */ React169__default.createElement(EditableCombobox, { options: comboboxOptions.subjects, value: subjectCode, onChange: setSubjectCode, placeholder: "Select or type a Subject..." })), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, null, "Topic"), /* @__PURE__ */ React169__default.createElement(EditableCombobox, { options: comboboxOptions.topics, value: topicCode, onChange: setTopicCode, placeholder: "Select or type a Topic...", disabled: !subjectCode })), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, null, "Grade Level"), /* @__PURE__ */ React169__default.createElement(EditableCombobox, { options: comboboxOptions.gradeLevels, value: gradeBand, onChange: setGradeBand, placeholder: "Select or type a Grade..." })), /* @__PURE__ */ React169__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React169__default.createElement(Label2, null, "Bloom's Level"), /* @__PURE__ */ React169__default.createElement(EditableCombobox, { options: comboboxOptions.bloomLevels, value: bloomLevelCode, onChange: setBloomLevelCode, placeholder: "Select a Bloom's Level..." }))), renderSpecificParams(), error && /* @__PURE__ */ React169__default.createElement("p", { className: "text-sm text-destructive flex items-center mt-2" }, /* @__PURE__ */ React169__default.createElement(TriangleAlert, { className: "mr-1 h-4 w-4" }), " ", error)), /* @__PURE__ */ React169__default.createElement(DialogFooter, null, /* @__PURE__ */ React169__default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React169__default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React169__default.createElement(Button, { type: "button", onClick: handleSubmit, disabled: isLoading || !prompt.trim() || !geminiApiKeyExists }, isLoading ? /* @__PURE__ */ React169__default.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React169__default.createElement(WandSparkles, { className: "mr-2 h-4 w-4" }), "Generate Question")))), /* @__PURE__ */ React169__default.createElement(APIKeyManagerModal, { isOpen: isApiKeyManagerModalOpen, onClose: handleApiKeyModalClose }));
|
|
101457
101353
|
};
|
|
101458
101354
|
|
|
101459
101355
|
// src/react-ui/components/authoring/AIFullQuizGeneratorModal.tsx
|
|
@@ -102284,7 +102180,7 @@ async function generateCodingQuestion(clientInput, apiKey) {
|
|
|
102284
102180
|
var MAX_ATTEMPTS = 3;
|
|
102285
102181
|
var RETRY_DELAY_MS10 = 2e3;
|
|
102286
102182
|
var delay = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
102287
|
-
var
|
|
102183
|
+
var calculateCombinedDifficulty = (plannedQ) => {
|
|
102288
102184
|
const { plannedBloomLevel, plannedQuestionType, plannedContextId } = plannedQ;
|
|
102289
102185
|
let contextScore = 1;
|
|
102290
102186
|
if (["SPEC_CASE", "NAT_OBS", "DATA_MOD", "INTERDISC", "HYPO_COMP"].includes(plannedContextId || "")) contextScore = 2;
|
|
@@ -102341,7 +102237,7 @@ async function generateQuestionsFromQuizPlan(clientInput, apiKey) {
|
|
|
102341
102237
|
const imageUrl = plannedQ.imageId && imageContexts ? imageContexts.find((ctx) => ctx.id === plannedQ.imageId)?.imageUrl : void 0;
|
|
102342
102238
|
const baseClientInput = {
|
|
102343
102239
|
language: language3,
|
|
102344
|
-
difficulty:
|
|
102240
|
+
difficulty: calculateCombinedDifficulty(plannedQ),
|
|
102345
102241
|
quizContext,
|
|
102346
102242
|
imageUrl
|
|
102347
102243
|
};
|
|
@@ -102423,6 +102319,22 @@ async function generateQuestionsFromQuizPlan(clientInput, apiKey) {
|
|
|
102423
102319
|
return { generatedQuestions, errors: errors2.length > 0 ? errors2 : void 0 };
|
|
102424
102320
|
}
|
|
102425
102321
|
|
|
102322
|
+
// src/data/contextOptions.ts
|
|
102323
|
+
init_react_shim();
|
|
102324
|
+
var contextOptions = [
|
|
102325
|
+
{ 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" },
|
|
102326
|
+
{ 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" },
|
|
102327
|
+
{ 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" },
|
|
102328
|
+
{ 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" },
|
|
102329
|
+
{ 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" },
|
|
102330
|
+
{ 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" },
|
|
102331
|
+
{ 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" },
|
|
102332
|
+
{ 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" },
|
|
102333
|
+
{ 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" },
|
|
102334
|
+
{ 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" },
|
|
102335
|
+
{ shortContextId: "__custom__", contextId: "__custom__", contextDescription: "Other (Custom Input)", contextExample: "", keywords: "custom, other, specific" }
|
|
102336
|
+
];
|
|
102337
|
+
|
|
102426
102338
|
// src/react-ui/components/authoring/AIFullQuizGeneratorModal.tsx
|
|
102427
102339
|
var availableQuestionTypesForFullQuiz = [
|
|
102428
102340
|
{ value: "true_false", label: "True/False" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { s as QuizConfig, g as QuizQuestion,
|
|
4
|
-
import {
|
|
3
|
+
import { s as QuizConfig, g as QuizQuestion, Q as QuestionTypeStrings, r as QuizSettings } from './quiz-config-o4j2dfsu.cjs';
|
|
4
|
+
import { Subject, Topic, GradeLevel, BloomLevelType, QuestionInBank, QuestionFilters as QuestionFilters$1, Category, QuestionTypeType, LearningObjectiveMetadata, Context, Approach } from './index.cjs';
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
6
|
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
@@ -25,6 +25,11 @@ interface AIQuestionGeneratorModalProps {
|
|
|
25
25
|
onClose: () => void;
|
|
26
26
|
onQuestionGenerated: (question: QuizQuestion) => void;
|
|
27
27
|
language: string;
|
|
28
|
+
questionType?: QuestionTypeStrings;
|
|
29
|
+
subjects?: Subject[];
|
|
30
|
+
topics?: Topic[];
|
|
31
|
+
gradeLevels?: GradeLevel[];
|
|
32
|
+
bloomLevels?: BloomLevelType[];
|
|
28
33
|
}
|
|
29
34
|
declare const AIQuestionGeneratorModal: React__default.FC<AIQuestionGeneratorModalProps>;
|
|
30
35
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { s as QuizConfig, g as QuizQuestion,
|
|
4
|
-
import {
|
|
3
|
+
import { s as QuizConfig, g as QuizQuestion, Q as QuestionTypeStrings, r as QuizSettings } from './quiz-config-o4j2dfsu.js';
|
|
4
|
+
import { Subject, Topic, GradeLevel, BloomLevelType, QuestionInBank, QuestionFilters as QuestionFilters$1, Category, QuestionTypeType, LearningObjectiveMetadata, Context, Approach } from './index.js';
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
6
|
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
@@ -25,6 +25,11 @@ interface AIQuestionGeneratorModalProps {
|
|
|
25
25
|
onClose: () => void;
|
|
26
26
|
onQuestionGenerated: (question: QuizQuestion) => void;
|
|
27
27
|
language: string;
|
|
28
|
+
questionType?: QuestionTypeStrings;
|
|
29
|
+
subjects?: Subject[];
|
|
30
|
+
topics?: Topic[];
|
|
31
|
+
gradeLevels?: GradeLevel[];
|
|
32
|
+
bloomLevels?: BloomLevelType[];
|
|
28
33
|
}
|
|
29
34
|
declare const AIQuestionGeneratorModal: React__default.FC<AIQuestionGeneratorModalProps>;
|
|
30
35
|
|
package/package.json
CHANGED