feat(cefr): CEFR level testing and automated gap ingestion engine (Task 15)
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user