Adaptiven A1-Kurs und statistisches Aussprachetraining integrieren
Direkte DeepSeek- und Mistral-Anbindung mit versionierten Aktionsprofilen, Budgetreservierung, Tokenabrechnung und administrativen Qualitätsprüfungen ersetzen die Flowise-Abhängigkeit im regulären Betrieb. 840 geprüfte A1-Aufgaben mit geschützter Testauswertung und konkreten offenen Arbeitsaufträgen ergänzen den Kurs. Inhalts- und Sprachbewertung bleiben von Azure-Aussprachewerten getrennt; historische Aufgaben und Antworten bleiben erhalten. Echte Wort- und Phonemmessungen werden mit Herkunft, Aktualität und Nachweisdichte gebündelt. Go bestimmt Trainingsziele und Wiederholungen, das Modell formuliert dazu passende Nachsprechübungen. Profilansicht und Auswahlgründe werden angezeigt. Validierung: Go-Race-Tests mit lokaler PostgreSQL-Integration, go vet, Web-Build, Audit aller 840 Aufgaben und drei Browser-Smokes mit lokalen Modell-/Speech-Fixtures bestanden. Keine Produktionsänderungen oder Live-Aufrufe.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"log/slog"
|
||||
"testing"
|
||||
|
||||
"speech-learning-api/internal/domain"
|
||||
"speech-learning-api/internal/services"
|
||||
)
|
||||
|
||||
type pronunciationHistoryStore struct {
|
||||
DataStore
|
||||
user, language, level string
|
||||
fallbackAvoid []string
|
||||
}
|
||||
|
||||
func (s *pronunciationHistoryStore) RecentPronunciationTexts(_ context.Context, user, language, level string) ([]string, error) {
|
||||
s.user, s.language, s.level = user, language, level
|
||||
return []string{"Saved after reload."}, nil
|
||||
}
|
||||
func (s *pronunciationHistoryStore) NextLessonAndExercise(_ context.Context, _ domain.LearnerProfile, avoid ...string) (domain.Lesson, domain.Exercise, error) {
|
||||
s.fallbackAvoid = avoid
|
||||
return domain.Lesson{}, domain.Exercise{Source: "seed"}, nil
|
||||
}
|
||||
|
||||
type pronunciationHistoryTeacher struct {
|
||||
services.TeacherAgent
|
||||
request domain.GeneratedExerciseRequest
|
||||
}
|
||||
|
||||
func (t *pronunciationHistoryTeacher) NextExercise(_ context.Context, request domain.GeneratedExerciseRequest) (domain.GeneratedExercise, error) {
|
||||
t.request = request
|
||||
return domain.GeneratedExercise{}, nil
|
||||
}
|
||||
func TestPronunciationLoadsHistoryWithoutClientIDs(t *testing.T) {
|
||||
for _, client := range [][]string{nil, {"From browser."}} {
|
||||
repo, teacher := &pronunciationHistoryStore{}, &pronunciationHistoryTeacher{}
|
||||
s := &Server{store: repo, teacher: teacher, logger: slog.New(slog.NewTextHandler(io.Discard, nil))}
|
||||
_, _, err := s.nextAgentExercise(context.Background(), domain.User{ID: "learner"}, domain.LearnerProfile{TargetLanguage: "en-US", CEFRLevel: "A1"}, domain.ProgressSummary{}, client)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if repo.user != "learner" || repo.language != "en-US" || repo.level != "A1" {
|
||||
t.Fatal("wrong history scope")
|
||||
}
|
||||
avoid := teacher.request.AvoidReferenceTexts
|
||||
if len(avoid) != len(client)+1 || avoid[len(avoid)-1] != "Saved after reload." {
|
||||
t.Fatalf("history not passed to generator: %v", avoid)
|
||||
}
|
||||
if len(repo.fallbackAvoid) != len(client) {
|
||||
t.Fatal("history exhausted fixed fallback")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user