@thanh01.pmt/interactive-quiz-kit 1.0.63 → 1.0.65
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 +88 -224
- package/dist/authoring.d.cts +1 -1
- package/dist/authoring.d.ts +1 -1
- package/dist/authoring.mjs +88 -224
- package/dist/react-ui.cjs +1706 -1844
- package/dist/react-ui.d.cts +1 -1
- package/dist/react-ui.d.ts +1 -1
- package/dist/react-ui.mjs +1706 -1844
- 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/authoring.mjs
CHANGED
|
@@ -6580,7 +6580,8 @@ var QuizContextSchema = z.object({
|
|
|
6580
6580
|
originalSubject: z.string().optional(),
|
|
6581
6581
|
originalCategory: z.string().optional(),
|
|
6582
6582
|
originalTopic: z.string().optional(),
|
|
6583
|
-
loDescription: z.string().optional().describe("The full description of the learning objective for deep context.")
|
|
6583
|
+
loDescription: z.string().optional().describe("The full description of the learning objective for deep context."),
|
|
6584
|
+
gradeBand: z.string().optional()
|
|
6584
6585
|
});
|
|
6585
6586
|
var BaseQuestionGenerationClientInputSchema = z.object({
|
|
6586
6587
|
language: z.string().optional().default("English"),
|
|
@@ -72896,7 +72897,7 @@ var EditQuestionModal = ({
|
|
|
72896
72897
|
if (!isOpen || !editedQuestion) return null;
|
|
72897
72898
|
return /* @__PURE__ */ React95__default.createElement(Dialog2, { open: isOpen, onOpenChange: (open) => {
|
|
72898
72899
|
if (!open) onClose();
|
|
72899
|
-
} }, /* @__PURE__ */ React95__default.createElement(DialogContent2, { className: "
|
|
72900
|
+
} }, /* @__PURE__ */ React95__default.createElement(DialogContent2, { className: "sm:max-w-[600px] md:max-w-[800px] lg:max-w-[1000px] max-h-[90vh]" }, /* @__PURE__ */ React95__default.createElement(DialogHeader, null, /* @__PURE__ */ React95__default.createElement(DialogTitle2, { className: "font-headline text-2xl" }, questionData?.id && !questionData.id.startsWith("new_") && !questionData.id.startsWith("temp_") ? "Edit Question" : "Add New Question"), /* @__PURE__ */ React95__default.createElement(DialogDescription2, null, "Configure the details for this question. Current type:", " ", /* @__PURE__ */ React95__default.createElement("span", { className: "font-semibold" }, editedQuestion.questionType))), /* @__PURE__ */ React95__default.createElement(ScrollArea2, { className: "max-h-[calc(80vh-150px)] p-1 pr-6" }, /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-6 p-4" }, /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "prompt", className: "font-semibold" }, "Question Prompt"), /* @__PURE__ */ React95__default.createElement(SimpleMarkdownEditor, { value: editedQuestion.prompt, onChange: (htmlContent) => handleSpecificFieldChange({ prompt: htmlContent }) })), renderSpecificForm(), /* @__PURE__ */ React95__default.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 pt-4 border-t" }, /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "points" }, "Points"), /* @__PURE__ */ React95__default.createElement(Input, { id: "points", type: "number", value: editedQuestion.points || 0, onChange: (e2) => handleSpecificFieldChange({ points: parseInt(e2.target.value, 10) || 0 }), min: "0" })), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "difficulty" }, "Difficulty"), /* @__PURE__ */ React95__default.createElement(Select2, { value: editedQuestion.difficulty || "medium", onValueChange: (value) => handleSpecificFieldChange({ difficulty: value }) }, /* @__PURE__ */ React95__default.createElement(SelectTrigger2, null, /* @__PURE__ */ React95__default.createElement(SelectValue2, null)), /* @__PURE__ */ React95__default.createElement(SelectContent2, null, /* @__PURE__ */ React95__default.createElement(SelectItem2, { value: "easy" }, "Easy"), /* @__PURE__ */ React95__default.createElement(SelectItem2, { value: "medium" }, "Medium"), /* @__PURE__ */ React95__default.createElement(SelectItem2, { value: "hard" }, "Hard"))))), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "explanation" }, "Explanation (Optional)"), /* @__PURE__ */ React95__default.createElement(SimpleMarkdownEditor, { value: editedQuestion.explanation || "", onChange: (htmlContent) => handleSpecificFieldChange({ explanation: htmlContent }), minHeight: "100px" })), /* @__PURE__ */ React95__default.createElement("details", { className: "group", open: hasDropdownMetadata }, /* @__PURE__ */ React95__default.createElement("summary", { className: "cursor-pointer font-semibold text-primary hover:underline" }, "Advanced Metadata (Optional)"), renderMetadataFields()))), /* @__PURE__ */ React95__default.createElement(DialogFooter, { className: "pt-4 border-t" }, /* @__PURE__ */ React95__default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React95__default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React95__default.createElement(Button, { type: "button", onClick: handleSaveClick }, /* @__PURE__ */ React95__default.createElement(Save, { className: "mr-2 h-4 w-4" }), " Save Question"))));
|
|
72900
72901
|
};
|
|
72901
72902
|
|
|
72902
72903
|
// src/react-ui/components/authoring/AIQuestionGeneratorModal.tsx
|
|
@@ -72960,189 +72961,98 @@ var supportedQuestionTypesForAI = [
|
|
|
72960
72961
|
{ value: "sequence", label: "Sequence" },
|
|
72961
72962
|
{ value: "matching", label: "Matching" }
|
|
72962
72963
|
];
|
|
72963
|
-
var contextOptions = [
|
|
72964
|
-
{ 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" },
|
|
72965
|
-
{ 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" },
|
|
72966
|
-
{ 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" },
|
|
72967
|
-
{ 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" },
|
|
72968
|
-
{ 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" },
|
|
72969
|
-
{ 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" },
|
|
72970
|
-
{ 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" },
|
|
72971
|
-
{ 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" },
|
|
72972
|
-
{ 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" },
|
|
72973
|
-
{ 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" },
|
|
72974
|
-
{ shortContextId: "__custom__", contextId: "__custom__", contextDescription: "Other (Custom Input)", contextExample: "", keywords: "custom, other, specific" }
|
|
72975
|
-
];
|
|
72976
|
-
var bloomLevelOptions = [
|
|
72977
|
-
{ value: "remembering", label: "Nh\u1EDB - D\u1EC5 (Remembering)" },
|
|
72978
|
-
{ value: "understanding", label: "Hi\u1EC3u - Trung B\xECnh (Understanding)" },
|
|
72979
|
-
{ value: "applying", label: "V\u1EADn D\u1EE5ng - Kh\xF3 (Applying)" }
|
|
72980
|
-
];
|
|
72981
|
-
var calculateCombinedDifficulty2 = (contextId, bloomLevel, qType, customContextInput) => {
|
|
72982
|
-
let contextScore = 1;
|
|
72983
|
-
const selectedContext = contextOptions.find((c2) => c2.contextId === contextId);
|
|
72984
|
-
if (selectedContext) {
|
|
72985
|
-
if (["THEO_ABS", "HIST_SCI", "__none__"].includes(selectedContext.contextId) || selectedContext.contextId === "__custom__" && !customContextInput.trim()) {
|
|
72986
|
-
contextScore = 1;
|
|
72987
|
-
} else if (["SPEC_CASE", "NAT_OBS", "DATA_MOD", "INTERDISC", "HYPO_COMP"].includes(selectedContext.contextId) || selectedContext.contextId === "__custom__" && customContextInput.trim()) {
|
|
72988
|
-
contextScore = 2;
|
|
72989
|
-
} else if (["TECH_ENG", "EXP_INV", "REAL_PROB"].includes(selectedContext.contextId)) {
|
|
72990
|
-
contextScore = 3;
|
|
72991
|
-
}
|
|
72992
|
-
} else if (contextId === "__custom__" && customContextInput.trim()) {
|
|
72993
|
-
contextScore = 2;
|
|
72994
|
-
}
|
|
72995
|
-
let bloomScore = 1;
|
|
72996
|
-
if (bloomLevel === "understanding") bloomScore = 2;
|
|
72997
|
-
else if (bloomLevel === "applying") bloomScore = 3;
|
|
72998
|
-
let questionTypeScore = 1;
|
|
72999
|
-
switch (qType) {
|
|
73000
|
-
case "true_false":
|
|
73001
|
-
case "multiple_choice":
|
|
73002
|
-
case "short_answer":
|
|
73003
|
-
questionTypeScore = 1;
|
|
73004
|
-
break;
|
|
73005
|
-
case "matching":
|
|
73006
|
-
case "fill_in_the_blanks":
|
|
73007
|
-
case "numeric":
|
|
73008
|
-
questionTypeScore = 2;
|
|
73009
|
-
break;
|
|
73010
|
-
case "sequence":
|
|
73011
|
-
case "multiple_response":
|
|
73012
|
-
questionTypeScore = 3;
|
|
73013
|
-
break;
|
|
73014
|
-
default:
|
|
73015
|
-
questionTypeScore = 1;
|
|
73016
|
-
}
|
|
73017
|
-
const totalScore = bloomScore + contextScore + questionTypeScore;
|
|
73018
|
-
if (totalScore <= 4) return "easy";
|
|
73019
|
-
if (totalScore <= 6) return "medium";
|
|
73020
|
-
return "hard";
|
|
73021
|
-
};
|
|
73022
72964
|
var AIQuestionGeneratorModal = ({
|
|
73023
72965
|
isOpen,
|
|
73024
72966
|
onClose,
|
|
73025
72967
|
onQuestionGenerated,
|
|
73026
|
-
language: language3
|
|
73027
|
-
|
|
72968
|
+
language: language3,
|
|
72969
|
+
questionType: questionTypeProp,
|
|
72970
|
+
subjects = [],
|
|
72971
|
+
topics = [],
|
|
72972
|
+
gradeLevels = [],
|
|
72973
|
+
bloomLevels = []
|
|
73028
72974
|
}) => {
|
|
73029
|
-
const [
|
|
73030
|
-
const [selectedContextId, setSelectedContextId] = useState("__none__");
|
|
73031
|
-
const [customContextInput, setCustomContextInput] = useState("");
|
|
73032
|
-
const [questionType, setQuestionType] = useState("multiple_choice");
|
|
73033
|
-
const [selectedBloomLevel, setSelectedBloomLevel] = useState("remembering");
|
|
72975
|
+
const [prompt, setPrompt] = useState("");
|
|
73034
72976
|
const [isLoading, setIsLoading] = useState(false);
|
|
73035
72977
|
const [error, setError] = useState(null);
|
|
73036
|
-
const [computedDifficultyForDisplay, setComputedDifficultyForDisplay] = useState(null);
|
|
73037
72978
|
const { toast: toast2 } = useToast();
|
|
73038
|
-
const [
|
|
73039
|
-
const [
|
|
73040
|
-
const [
|
|
73041
|
-
const [
|
|
73042
|
-
const [
|
|
73043
|
-
const [numberOfSequenceItems, setNumberOfSequenceItems] = useState(4);
|
|
73044
|
-
const [numberOfMatchingPairs, setNumberOfMatchingPairs] = useState(4);
|
|
72979
|
+
const [subjectCode, setSubjectCode] = useState("");
|
|
72980
|
+
const [topicCode, setTopicCode] = useState("");
|
|
72981
|
+
const [gradeBand, setGradeBand] = useState("");
|
|
72982
|
+
const [bloomLevelCode, setBloomLevelCode] = useState("");
|
|
72983
|
+
const [selectedQuestionType, setSelectedQuestionType] = useState("multiple_choice");
|
|
73045
72984
|
const [isApiKeyManagerModalOpen, setIsApiKeyManagerModalOpen] = useState(false);
|
|
73046
72985
|
const [geminiApiKeyExists, setGeminiApiKeyExists] = useState(false);
|
|
72986
|
+
const finalQuestionType = questionTypeProp || selectedQuestionType;
|
|
73047
72987
|
useEffect(() => {
|
|
73048
72988
|
if (isOpen) {
|
|
73049
|
-
|
|
73050
|
-
setSelectedContextId("__none__");
|
|
73051
|
-
setCustomContextInput("");
|
|
73052
|
-
setQuestionType("multiple_choice");
|
|
73053
|
-
setSelectedBloomLevel("remembering");
|
|
72989
|
+
setPrompt("");
|
|
73054
72990
|
setError(null);
|
|
73055
72991
|
setIsLoading(false);
|
|
73056
|
-
|
|
73057
|
-
|
|
73058
|
-
|
|
73059
|
-
|
|
73060
|
-
|
|
73061
|
-
setNumberOfSequenceItems(4);
|
|
73062
|
-
setNumberOfMatchingPairs(4);
|
|
73063
|
-
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
73064
|
-
}
|
|
73065
|
-
}, [isOpen]);
|
|
73066
|
-
useEffect(() => {
|
|
73067
|
-
if (isOpen) {
|
|
73068
|
-
const difficulty = calculateCombinedDifficulty2(selectedContextId, selectedBloomLevel, questionType, customContextInput);
|
|
73069
|
-
setComputedDifficultyForDisplay(difficulty);
|
|
72992
|
+
setSubjectCode("");
|
|
72993
|
+
setTopicCode("");
|
|
72994
|
+
setGradeBand("");
|
|
72995
|
+
setBloomLevelCode("");
|
|
72996
|
+
setSelectedQuestionType(questionTypeProp || "multiple_choice");
|
|
73070
72997
|
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
73071
72998
|
}
|
|
73072
|
-
}, [
|
|
72999
|
+
}, [isOpen, questionTypeProp]);
|
|
73000
|
+
const filteredTopics = useMemo(() => {
|
|
73001
|
+
if (!subjectCode) return [];
|
|
73002
|
+
return topics.filter((t2) => t2.subjectCode === subjectCode);
|
|
73003
|
+
}, [subjectCode, topics]);
|
|
73073
73004
|
const handleApiKeyModalClose = () => {
|
|
73074
73005
|
setIsApiKeyManagerModalOpen(false);
|
|
73075
73006
|
setGeminiApiKeyExists(APIKeyService.hasAPIKey(GEMINI_API_KEY_SERVICE_NAME));
|
|
73076
73007
|
};
|
|
73077
73008
|
const handleSubmit = async () => {
|
|
73078
|
-
if (!
|
|
73079
|
-
setError("Please provide a
|
|
73009
|
+
if (!prompt.trim()) {
|
|
73010
|
+
setError("Please provide a prompt for the question.");
|
|
73080
73011
|
return;
|
|
73081
73012
|
}
|
|
73082
73013
|
const geminiKey = APIKeyService.getAPIKey(GEMINI_API_KEY_SERVICE_NAME);
|
|
73083
73014
|
if (!geminiKey) {
|
|
73084
|
-
setError("Gemini API Key is not set. Please
|
|
73015
|
+
setError("Gemini API Key is not set. Please configure it.");
|
|
73085
73016
|
setGeminiApiKeyExists(false);
|
|
73086
73017
|
return;
|
|
73087
73018
|
}
|
|
73088
73019
|
setGeminiApiKeyExists(true);
|
|
73089
73020
|
setError(null);
|
|
73090
73021
|
setIsLoading(true);
|
|
73091
|
-
let contextDescriptionForAI = void 0;
|
|
73092
|
-
if (selectedContextId === "__custom__") {
|
|
73093
|
-
contextDescriptionForAI = customContextInput.trim() || void 0;
|
|
73094
|
-
} else if (selectedContextId && selectedContextId !== "__none__") {
|
|
73095
|
-
const selectedContextObj = contextOptions.find((c2) => c2.contextId === selectedContextId);
|
|
73096
|
-
contextDescriptionForAI = selectedContextObj?.contextDescription;
|
|
73097
|
-
}
|
|
73098
|
-
const finalDifficultyForAI = calculateCombinedDifficulty2(selectedContextId, selectedBloomLevel, questionType, customContextInput);
|
|
73099
73022
|
try {
|
|
73100
|
-
|
|
73023
|
+
const quizContext = {
|
|
73024
|
+
plannedTopic: prompt,
|
|
73025
|
+
originalSubject: subjectCode,
|
|
73026
|
+
originalTopic: topicCode,
|
|
73027
|
+
gradeBand,
|
|
73028
|
+
plannedBloomLevel: bloomLevelCode
|
|
73029
|
+
};
|
|
73101
73030
|
const baseClientInput = {
|
|
73102
|
-
topic,
|
|
73103
73031
|
language: language3,
|
|
73104
|
-
|
|
73105
|
-
|
|
73106
|
-
contextDescription: contextDescriptionForAI,
|
|
73107
|
-
selectedContextId: selectedContextId !== "__none__" && selectedContextId !== "__custom__" ? selectedContextId : selectedContextId === "__custom__" && customContextInput.trim() ? "__custom__" : void 0
|
|
73032
|
+
difficulty: "medium",
|
|
73033
|
+
quizContext
|
|
73108
73034
|
};
|
|
73109
|
-
|
|
73035
|
+
let generatedResult = {};
|
|
73036
|
+
switch (finalQuestionType) {
|
|
73110
73037
|
case "true_false":
|
|
73111
|
-
|
|
73038
|
+
generatedResult = await generateTrueFalseQuestion(baseClientInput, geminiKey);
|
|
73112
73039
|
break;
|
|
73113
73040
|
case "multiple_choice":
|
|
73114
|
-
|
|
73115
|
-
break;
|
|
73116
|
-
case "multiple_response":
|
|
73117
|
-
if (minCorrectAnswers > maxCorrectAnswers || maxCorrectAnswers > numberOfOptions) {
|
|
73118
|
-
throw new Error("Invalid settings for Multiple Response correct answers count or number of options.");
|
|
73119
|
-
}
|
|
73120
|
-
generatedQuestionData = await generateMRQQuestion({ ...baseClientInput, numberOfOptions, minCorrectAnswers, maxCorrectAnswers }, geminiKey);
|
|
73121
|
-
break;
|
|
73122
|
-
case "short_answer":
|
|
73123
|
-
generatedQuestionData = await generateShortAnswerQuestion({ ...baseClientInput, isCaseSensitive }, geminiKey);
|
|
73124
|
-
break;
|
|
73125
|
-
case "numeric":
|
|
73126
|
-
generatedQuestionData = await generateNumericQuestion({ ...baseClientInput, allowDecimals: true, tolerance: 0 }, geminiKey);
|
|
73127
|
-
break;
|
|
73128
|
-
case "fill_in_the_blanks":
|
|
73129
|
-
generatedQuestionData = await generateFillInTheBlanksQuestion({ ...baseClientInput, numberOfBlanks, isCaseSensitive }, geminiKey);
|
|
73130
|
-
break;
|
|
73131
|
-
case "sequence":
|
|
73132
|
-
generatedQuestionData = await generateSequenceQuestion({ ...baseClientInput, numberOfItems: numberOfSequenceItems }, geminiKey);
|
|
73133
|
-
break;
|
|
73134
|
-
case "matching":
|
|
73135
|
-
generatedQuestionData = await generateMatchingQuestion({ ...baseClientInput, numberOfPairs: numberOfMatchingPairs, shuffleOptions: true }, geminiKey);
|
|
73041
|
+
generatedResult = await generateMCQQuestion({ ...baseClientInput, numberOfOptions: 4 }, geminiKey);
|
|
73136
73042
|
break;
|
|
73043
|
+
// Add other cases as needed
|
|
73137
73044
|
default:
|
|
73138
|
-
|
|
73139
|
-
|
|
73140
|
-
|
|
73141
|
-
|
|
73142
|
-
|
|
73143
|
-
|
|
73144
|
-
completeQuestion
|
|
73145
|
-
completeQuestion.
|
|
73045
|
+
throw new Error(`AI generation for '${finalQuestionType}' is not implemented in this flow.`);
|
|
73046
|
+
}
|
|
73047
|
+
if (generatedResult.error) {
|
|
73048
|
+
throw new Error(generatedResult.error);
|
|
73049
|
+
}
|
|
73050
|
+
if (generatedResult.question) {
|
|
73051
|
+
const completeQuestion = generatedResult.question;
|
|
73052
|
+
completeQuestion.subject = subjectCode;
|
|
73053
|
+
completeQuestion.topic = topicCode;
|
|
73054
|
+
completeQuestion.gradeBand = gradeBand;
|
|
73055
|
+
completeQuestion.bloomLevel = bloomLevelCode;
|
|
73146
73056
|
if (completeQuestion.points === void 0) completeQuestion.points = 10;
|
|
73147
73057
|
onQuestionGenerated(completeQuestion);
|
|
73148
73058
|
toast2({ title: "AI Question Generated", description: "Review and edit the generated question." });
|
|
@@ -73152,9 +73062,9 @@ var AIQuestionGeneratorModal = ({
|
|
|
73152
73062
|
}
|
|
73153
73063
|
} catch (e2) {
|
|
73154
73064
|
console.error("AI Question Generation Error:", e2);
|
|
73155
|
-
let errorMessage = e2.message || "An unknown error occurred
|
|
73156
|
-
if (typeof errorMessage === "string" &&
|
|
73157
|
-
errorMessage = "The provided Google Gemini API Key is invalid
|
|
73065
|
+
let errorMessage = e2.message || "An unknown error occurred.";
|
|
73066
|
+
if (typeof errorMessage === "string" && errorMessage.includes("API key not valid")) {
|
|
73067
|
+
errorMessage = "The provided Google Gemini API Key is invalid. Please check it.";
|
|
73158
73068
|
setGeminiApiKeyExists(false);
|
|
73159
73069
|
}
|
|
73160
73070
|
setError(errorMessage);
|
|
@@ -73163,92 +73073,46 @@ var AIQuestionGeneratorModal = ({
|
|
|
73163
73073
|
setIsLoading(false);
|
|
73164
73074
|
}
|
|
73165
73075
|
};
|
|
73166
|
-
const
|
|
73167
|
-
|
|
73168
|
-
|
|
73169
|
-
|
|
73170
|
-
|
|
73171
|
-
Input,
|
|
73172
|
-
{
|
|
73173
|
-
id: "ai-num-options",
|
|
73174
|
-
type: "number",
|
|
73175
|
-
value: numberOfOptions,
|
|
73176
|
-
onChange: (e2) => setNumberOfOptions(parseInt(e2.target.value, 10)),
|
|
73177
|
-
min: 2,
|
|
73178
|
-
max: questionType === "multiple_choice" ? 6 : 8
|
|
73179
|
-
}
|
|
73180
|
-
), questionType === "multiple_response" && /* @__PURE__ */ React95__default.createElement(React95__default.Fragment, null, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-min-correct" }, "Min Correct Answers (MRQ)"), /* @__PURE__ */ React95__default.createElement(Input, { id: "ai-min-correct", type: "number", value: minCorrectAnswers, onChange: (e2) => setMinCorrectAnswers(parseInt(e2.target.value, 10)), min: 1, max: numberOfOptions }), /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-max-correct" }, "Max Correct Answers (MRQ)"), /* @__PURE__ */ React95__default.createElement(Input, { id: "ai-max-correct", type: "number", value: maxCorrectAnswers, onChange: (e2) => setMaxCorrectAnswers(parseInt(e2.target.value, 10)), min: minCorrectAnswers, max: numberOfOptions })));
|
|
73181
|
-
case "short_answer":
|
|
73182
|
-
case "fill_in_the_blanks":
|
|
73183
|
-
return /* @__PURE__ */ React95__default.createElement("div", { className: "flex items-center space-x-2" }, /* @__PURE__ */ React95__default.createElement("input", { type: "checkbox", id: "ai-case-sensitive", checked: isCaseSensitive, onChange: (e2) => setIsCaseSensitive(e2.target.checked), className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary" }), /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-case-sensitive" }, "Case Sensitive Answers"), questionType === "fill_in_the_blanks" && /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-1 ml-4" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-num-blanks" }, "Approx. Number of Blanks (1-5)"), /* @__PURE__ */ React95__default.createElement(Input, { id: "ai-num-blanks", type: "number", value: numberOfBlanks, onChange: (e2) => setNumberOfBlanks(parseInt(e2.target.value, 10)), min: 1, max: 5 })));
|
|
73184
|
-
case "sequence":
|
|
73185
|
-
return /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-num-seq-items" }, "Number of Items to Sequence (2-10)"), /* @__PURE__ */ React95__default.createElement(Input, { id: "ai-num-seq-items", type: "number", value: numberOfSequenceItems, onChange: (e2) => setNumberOfSequenceItems(parseInt(e2.target.value, 10)), min: 2, max: 10 }));
|
|
73186
|
-
case "matching":
|
|
73187
|
-
return /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-num-match-pairs" }, "Number of Pairs to Match (2-8)"), /* @__PURE__ */ React95__default.createElement(Input, { id: "ai-num-match-pairs", type: "number", value: numberOfMatchingPairs, onChange: (e2) => setNumberOfMatchingPairs(parseInt(e2.target.value, 10)), min: 2, max: 8 }));
|
|
73188
|
-
default:
|
|
73189
|
-
return null;
|
|
73190
|
-
}
|
|
73076
|
+
const comboboxOptions = {
|
|
73077
|
+
subjects: subjects.map((s2) => ({ value: s2.code, label: s2.name })),
|
|
73078
|
+
topics: filteredTopics.map((t2) => ({ value: t2.code, label: t2.name })),
|
|
73079
|
+
gradeLevels: gradeLevels.map((g) => ({ value: g.code, label: g.name })),
|
|
73080
|
+
bloomLevels: bloomLevels.map((b) => ({ value: b.code, label: b.name }))
|
|
73191
73081
|
};
|
|
73192
73082
|
return /* @__PURE__ */ React95__default.createElement(React95__default.Fragment, null, /* @__PURE__ */ React95__default.createElement(Dialog2, { open: isOpen, onOpenChange: (open) => {
|
|
73193
73083
|
if (!open) onClose();
|
|
73194
|
-
} }, /* @__PURE__ */ React95__default.createElement(DialogContent2, { className: "sm:max-w-[
|
|
73195
|
-
Button,
|
|
73196
|
-
{
|
|
73197
|
-
variant: "link",
|
|
73198
|
-
className: "p-0 h-auto text-xs text-amber-700 hover:text-amber-800 mt-1",
|
|
73199
|
-
onClick: () => {
|
|
73200
|
-
onClose();
|
|
73201
|
-
setIsApiKeyManagerModalOpen(true);
|
|
73202
|
-
}
|
|
73203
|
-
},
|
|
73204
|
-
"Set API Key Now"
|
|
73205
|
-
)))), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-topic" }, "Topic"), /* @__PURE__ */ React95__default.createElement(
|
|
73206
|
-
Textarea,
|
|
73207
|
-
{
|
|
73208
|
-
id: "ai-topic",
|
|
73209
|
-
value: topic,
|
|
73210
|
-
onChange: (e2) => setTopic(e2.target.value),
|
|
73211
|
-
placeholder: "e.g., Photosynthesis, World War II History, Basic Algebra Equations",
|
|
73212
|
-
className: "min-h-[80px]"
|
|
73213
|
-
}
|
|
73214
|
-
)), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-context-select" }, "Context (Optional)"), /* @__PURE__ */ React95__default.createElement(
|
|
73215
|
-
Select2,
|
|
73216
|
-
{
|
|
73217
|
-
value: selectedContextId,
|
|
73218
|
-
onValueChange: (value) => setSelectedContextId(value)
|
|
73219
|
-
},
|
|
73220
|
-
/* @__PURE__ */ React95__default.createElement(SelectTrigger2, { id: "ai-context-select" }, /* @__PURE__ */ React95__default.createElement(SelectValue2, { placeholder: "Select a context or choose 'Other'..." })),
|
|
73221
|
-
/* @__PURE__ */ React95__default.createElement(SelectContent2, null, /* @__PURE__ */ React95__default.createElement(SelectItem2, { value: "__none__" }, "None (General Topic)"), contextOptions.map((opt) => /* @__PURE__ */ React95__default.createElement(SelectItem2, { key: opt.contextId, value: opt.contextId }, opt.contextDescription, " ", opt.shortContextId !== "__custom__" ? `(${opt.shortContextId})` : "")))
|
|
73222
|
-
)), selectedContextId === "__custom__" && /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-custom-context" }, "Custom Context"), /* @__PURE__ */ React95__default.createElement(
|
|
73084
|
+
} }, /* @__PURE__ */ React95__default.createElement(DialogContent2, { className: "sm:max-w-[600px]" }, /* @__PURE__ */ React95__default.createElement(DialogHeader, null, /* @__PURE__ */ React95__default.createElement(DialogTitle2, { className: "flex items-center font-headline text-2xl" }, /* @__PURE__ */ React95__default.createElement(WandSparkles, { className: "mr-2 h-6 w-6 text-primary" }), " AI Question Generator"), /* @__PURE__ */ React95__default.createElement(DialogDescription2, null, "Provide a prompt and metadata to generate a '", finalQuestionType, "' question.")), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-4 py-4 max-h-[60vh] overflow-y-auto px-2" }, !geminiApiKeyExists && /* @__PURE__ */ React95__default.createElement("div", { className: "p-3 mb-4 border border-amber-500 bg-amber-50 rounded-md text-amber-700" }), !questionTypeProp && /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-q-type-select" }, "Question Type"), /* @__PURE__ */ React95__default.createElement(Select2, { value: selectedQuestionType, onValueChange: (v) => setSelectedQuestionType(v) }, /* @__PURE__ */ React95__default.createElement(SelectTrigger2, { id: "ai-q-type-select" }, /* @__PURE__ */ React95__default.createElement(SelectValue2, null)), /* @__PURE__ */ React95__default.createElement(SelectContent2, null, supportedQuestionTypesForAI.map((type) => /* @__PURE__ */ React95__default.createElement(SelectItem2, { key: type.value, value: type.value }, type.label))))), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-prompt" }, "Prompt / Topic"), /* @__PURE__ */ React95__default.createElement(
|
|
73223
73085
|
Textarea,
|
|
73224
73086
|
{
|
|
73225
|
-
id: "ai-
|
|
73226
|
-
value:
|
|
73227
|
-
onChange: (e2) =>
|
|
73228
|
-
placeholder: "
|
|
73229
|
-
className: "min-h-[
|
|
73087
|
+
id: "ai-prompt",
|
|
73088
|
+
value: prompt,
|
|
73089
|
+
onChange: (e2) => setPrompt(e2.target.value),
|
|
73090
|
+
placeholder: "e.g., The process of photosynthesis, The causes of World War II, Basic Algebra Equations",
|
|
73091
|
+
className: "min-h-[100px]"
|
|
73230
73092
|
}
|
|
73231
|
-
)), /* @__PURE__ */ React95__default.createElement("div", { className: "grid grid-cols-2 gap-4" }, /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, {
|
|
73232
|
-
Select2,
|
|
73233
|
-
{
|
|
73234
|
-
value: questionType,
|
|
73235
|
-
onValueChange: (value) => setQuestionType(value)
|
|
73236
|
-
},
|
|
73237
|
-
/* @__PURE__ */ React95__default.createElement(SelectTrigger2, { id: "ai-question-type" }, /* @__PURE__ */ React95__default.createElement(SelectValue2, { placeholder: "Select question type" })),
|
|
73238
|
-
/* @__PURE__ */ React95__default.createElement(SelectContent2, null, supportedQuestionTypesForAI.map((qType) => /* @__PURE__ */ React95__default.createElement(SelectItem2, { key: qType.value, value: qType.value }, qType.label)))
|
|
73239
|
-
)), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, { htmlFor: "ai-bloom-level" }, "Bloom Level"), /* @__PURE__ */ React95__default.createElement(
|
|
73240
|
-
Select2,
|
|
73241
|
-
{
|
|
73242
|
-
value: selectedBloomLevel,
|
|
73243
|
-
onValueChange: (value) => setSelectedBloomLevel(value)
|
|
73244
|
-
},
|
|
73245
|
-
/* @__PURE__ */ React95__default.createElement(SelectTrigger2, { id: "ai-bloom-level" }, /* @__PURE__ */ React95__default.createElement(SelectValue2, { placeholder: "Select Bloom Level" })),
|
|
73246
|
-
/* @__PURE__ */ React95__default.createElement(SelectContent2, null, bloomLevelOptions.map((level) => /* @__PURE__ */ React95__default.createElement(SelectItem2, { key: level.value, value: level.value }, level.label)))
|
|
73247
|
-
))), renderSpecificParams(), computedDifficultyForDisplay && /* @__PURE__ */ React95__default.createElement("div", { className: "mt-3 p-3 border rounded-md bg-secondary/50" }, /* @__PURE__ */ React95__default.createElement("p", { className: "text-sm font-medium text-foreground" }, "Calculated AI Difficulty: ", /* @__PURE__ */ React95__default.createElement("span", { className: "font-bold text-primary capitalize" }, computedDifficultyForDisplay))), error && /* @__PURE__ */ React95__default.createElement("p", { className: "text-sm text-destructive flex items-center mt-2" }, /* @__PURE__ */ React95__default.createElement(TriangleAlert, { className: "mr-1 h-4 w-4" }), " ", error)), /* @__PURE__ */ React95__default.createElement(DialogFooter, null, /* @__PURE__ */ React95__default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React95__default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React95__default.createElement(Button, { type: "button", onClick: handleSubmit, disabled: isLoading || !topic.trim() || !geminiApiKeyExists }, isLoading ? /* @__PURE__ */ React95__default.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React95__default.createElement(WandSparkles, { className: "mr-2 h-4 w-4" }), "Generate Question")))), /* @__PURE__ */ React95__default.createElement(APIKeyManagerModal, { isOpen: isApiKeyManagerModalOpen, onClose: handleApiKeyModalClose }));
|
|
73093
|
+
)), /* @__PURE__ */ React95__default.createElement("div", { className: "grid grid-cols-2 gap-4" }, /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, null, "Subject"), /* @__PURE__ */ React95__default.createElement(EditableCombobox, { options: comboboxOptions.subjects, value: subjectCode, onChange: setSubjectCode, placeholder: "Select or type a Subject..." })), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, null, "Topic"), /* @__PURE__ */ React95__default.createElement(EditableCombobox, { options: comboboxOptions.topics, value: topicCode, onChange: setTopicCode, placeholder: "Select or type a Topic...", disabled: !subjectCode })), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, null, "Grade Level"), /* @__PURE__ */ React95__default.createElement(EditableCombobox, { options: comboboxOptions.gradeLevels, value: gradeBand, onChange: setGradeBand, placeholder: "Select or type a Grade..." })), /* @__PURE__ */ React95__default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React95__default.createElement(Label2, null, "Bloom's Level"), /* @__PURE__ */ React95__default.createElement(EditableCombobox, { options: comboboxOptions.bloomLevels, value: bloomLevelCode, onChange: setBloomLevelCode, placeholder: "Select a Bloom's Level..." }))), error && /* @__PURE__ */ React95__default.createElement("p", { className: "text-sm text-destructive flex items-center mt-2" }, /* @__PURE__ */ React95__default.createElement(TriangleAlert, { className: "mr-1 h-4 w-4" }), " ", error)), /* @__PURE__ */ React95__default.createElement(DialogFooter, null, /* @__PURE__ */ React95__default.createElement(DialogClose2, { asChild: true }, /* @__PURE__ */ React95__default.createElement(Button, { type: "button", variant: "outline" }, "Cancel")), /* @__PURE__ */ React95__default.createElement(Button, { type: "button", onClick: handleSubmit, disabled: isLoading || !prompt.trim() || !geminiApiKeyExists }, isLoading ? /* @__PURE__ */ React95__default.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React95__default.createElement(WandSparkles, { className: "mr-2 h-4 w-4" }), "Generate Question")))), /* @__PURE__ */ React95__default.createElement(APIKeyManagerModal, { isOpen: isApiKeyManagerModalOpen, onClose: handleApiKeyModalClose }));
|
|
73248
73094
|
};
|
|
73249
73095
|
|
|
73250
73096
|
// src/react-ui/components/authoring/AIFullQuizGeneratorModal.tsx
|
|
73251
73097
|
init_react_shim();
|
|
73098
|
+
|
|
73099
|
+
// src/data/contextOptions.ts
|
|
73100
|
+
init_react_shim();
|
|
73101
|
+
var contextOptions = [
|
|
73102
|
+
{ 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" },
|
|
73103
|
+
{ 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" },
|
|
73104
|
+
{ 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" },
|
|
73105
|
+
{ 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" },
|
|
73106
|
+
{ 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" },
|
|
73107
|
+
{ 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" },
|
|
73108
|
+
{ 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" },
|
|
73109
|
+
{ 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" },
|
|
73110
|
+
{ 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" },
|
|
73111
|
+
{ 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" },
|
|
73112
|
+
{ shortContextId: "__custom__", contextId: "__custom__", contextDescription: "Other (Custom Input)", contextExample: "", keywords: "custom, other, specific" }
|
|
73113
|
+
];
|
|
73114
|
+
|
|
73115
|
+
// src/react-ui/components/authoring/AIFullQuizGeneratorModal.tsx
|
|
73252
73116
|
var availableQuestionTypesForFullQuiz = [
|
|
73253
73117
|
{ value: "true_false", label: "True/False" },
|
|
73254
73118
|
{ value: "multiple_choice", label: "Multiple Choice" },
|