feat(cefr): CEFR level testing and automated gap ingestion engine (Task 15)

This commit is contained in:
2026-10-06 15:24:33 +03:00
parent 1c3f03a64c
commit 3fae321322
11 changed files with 2926 additions and 10 deletions
+35
View File
@@ -213,5 +213,40 @@ export const api = {
body: JSON.stringify(payload)
});
}
},
// CEFR Level Tests & Gap Ingestion (Task 15)
cefr: {
async getLevels() {
const resp = await fetch('/api/cefr/levels');
if (resp.ok) return await resp.json();
throw new Error(`Failed to load CEFR levels: ${resp.status}`);
},
async getQuiz(level = 'A1', count = 10, mode = 'all') {
const resp = await fetch(`/api/cefr/quiz?level=${encodeURIComponent(level)}&count=${count}&mode=${encodeURIComponent(mode)}`);
if (resp.ok) return await resp.json();
throw new Error(`Failed to load CEFR quiz: ${resp.status}`);
},
async submitAnswer(questionId, selectedOption) {
const resp = await fetch('/api/cefr/answer', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
question_id: questionId,
selected_option: selectedOption
})
});
if (resp.ok) return await resp.json();
throw new Error(`Failed to submit answer: ${resp.status}`);
},
async resetLevel(level) {
const resp = await fetch('/api/cefr/reset', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ level })
});
if (resp.ok) return await resp.json();
throw new Error(`Failed to reset level: ${resp.status}`);
}
}
};