Flowise-Übungen stabilisieren und Lernfortschritt korrigieren
Vermeide kürzlich angezeigte Sätze bei neuen Übungen und frage Flowise bei Wiederholungen einmal erneut. Validiere strukturierte Antworten, protokolliere die Übungsquelle und schütze nutzerspezifische Übungs-IDs. Berechne schwierige Wörter anhand der neuesten Aussprache pro Wort. Passe das Lehrerfeedback an gute Bewertungen an und verbessere das Laden neuer Übungen im Web. Ergänze gezielte Go-Tests.
This commit is contained in:
@@ -1,17 +1,35 @@
|
||||
import { request } from './client';
|
||||
import type { Dashboard, Exercise, Lesson, ProgressSummary } from './types';
|
||||
|
||||
let pendingDashboardRequest: Promise<Dashboard> | null = null;
|
||||
|
||||
export function fetchDashboard() {
|
||||
return request<Dashboard>('/dashboard');
|
||||
if (!pendingDashboardRequest) {
|
||||
pendingDashboardRequest = request<Dashboard>('/dashboard').finally(() => {
|
||||
pendingDashboardRequest = null;
|
||||
});
|
||||
}
|
||||
return pendingDashboardRequest;
|
||||
}
|
||||
|
||||
export function fetchProgress() {
|
||||
return request<ProgressSummary>('/progress');
|
||||
}
|
||||
|
||||
export function fetchNextLesson() {
|
||||
export async function fetchNextLesson(fresh = false, recentExerciseIds: string[] = []) {
|
||||
if (!fresh && pendingDashboardRequest) {
|
||||
try {
|
||||
const dashboard = await pendingDashboardRequest;
|
||||
return { lesson: dashboard.next_lesson, exercise: dashboard.next_exercise };
|
||||
} catch {
|
||||
// A failed dashboard request should not prevent a direct practice request.
|
||||
}
|
||||
}
|
||||
return request<{ lesson: Lesson; exercise: Exercise }>('/lessons/next', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({})
|
||||
body: JSON.stringify(recentExerciseIds.length ? {
|
||||
previous_exercise_id: recentExerciseIds[recentExerciseIds.length - 1],
|
||||
recent_exercise_ids: recentExerciseIds
|
||||
} : {})
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user