feat(lessons): implement comprehensive lesson configurator, session runner and AI debrief (Beta)

This commit is contained in:
Antigravity committed 2026-10-07 13:03:16 +03:00
1 parent 31e105b2c2
commit 718e9797eb
12 files changed
+4093 -1

No files matched your search

+52
View File
@@ -422,5 +422,57 @@ export const api = {
if (resp.ok) return await resp.json();
throw new Error(`Failed to cancel task: ${resp.status}`);
}
},
// Comprehensive Lessons Configurator & Runner (Beta)
lessons: {
async getPresets() {
const resp = await fetch('/api/lessons/presets');
if (resp.ok) return await resp.json();
throw new Error(`Failed to get presets: ${resp.status}`);
},
async savePreset(payload) {
const resp = await fetch('/api/lessons/presets', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (resp.ok) return await resp.json();
throw new Error(`Failed to save preset: ${resp.status}`);
},
async deletePreset(presetId) {
const resp = await fetch(`/api/lessons/presets/${presetId}`, {
method: 'DELETE'
});
if (resp.ok) return await resp.json();
throw new Error(`Failed to delete preset: ${resp.status}`);
},
async getGrammarRecommendations() {
const resp = await fetch('/api/lessons/grammar-recommendations');
if (resp.ok) return await resp.json();
throw new Error(`Failed to get grammar recommendations: ${resp.status}`);
},
async getArticles(topic = null) {
let url = '/api/lessons/articles';
if (topic) url += `?topic=${encodeURIComponent(topic)}`;
const resp = await fetch(url);
if (resp.ok) return await resp.json();
throw new Error(`Failed to get articles: ${resp.status}`);
},
async submitDebrief(payload) {
const resp = await fetch('/api/lessons/debrief', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (resp.ok) return await resp.json();
throw new Error(`Failed to submit debrief: ${resp.status}`);
},
async getHistory(limit = 15) {
const resp = await fetch(`/api/lessons/history?limit=${limit}`);
if (resp.ok) return await resp.json();
throw new Error(`Failed to get lesson history: ${resp.status}`);
}
}
};