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:
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -30,7 +29,8 @@ func (s *Server) debugStatus(w http.ResponseWriter, r *http.Request) {
|
||||
"checks": map[string]any{
|
||||
"db": s.store.DebugStatus(r.Context()),
|
||||
"azure": s.azureStatus(),
|
||||
"flowise": s.flowiseStatus(r.Context()),
|
||||
"ai": s.aiStatus(r.Context()),
|
||||
"flowise": s.aiStatus(r.Context()),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -79,9 +79,9 @@ func (s *Server) debugConfig() map[string]any {
|
||||
"azure_mock": s.cfg.AzureMock,
|
||||
"azure_region": valueOr(s.cfg.AzureRegion, "not-set"),
|
||||
"azure_speech_key_set": s.cfg.AzureSpeechKey != "",
|
||||
"flowise_base_url": valueOr(s.cfg.FlowiseBaseURL, "not-set"),
|
||||
"flowise_chatflow_set": s.cfg.FlowiseChatflow != "",
|
||||
"flowise_api_key_set": s.cfg.FlowiseAPIKey != "",
|
||||
"ai_provider": "direct",
|
||||
"deepseek_api_key_set": s.cfg.DeepSeekAPIKey != "",
|
||||
"mistral_api_key_set": s.cfg.MistralAPIKey != "",
|
||||
"jwt_secret_configured": s.cfg.JWTSecret != "" && s.cfg.JWTSecret != "dev-secret-change-me",
|
||||
}
|
||||
}
|
||||
@@ -104,40 +104,33 @@ func (s *Server) azureStatus() debugCheck {
|
||||
}
|
||||
|
||||
func (s *Server) flowiseStatus(ctx context.Context) debugCheck {
|
||||
baseURL := strings.TrimRight(s.cfg.FlowiseBaseURL, "/")
|
||||
details := map[string]any{
|
||||
"base_url": valueOr(baseURL, "not-set"),
|
||||
"chatflow_set": s.cfg.FlowiseChatflow != "",
|
||||
"api_key_set": s.cfg.FlowiseAPIKey != "",
|
||||
return s.aiStatus(ctx)
|
||||
}
|
||||
func (s *Server) aiStatus(ctx context.Context) debugCheck {
|
||||
if s.ai == nil {
|
||||
return debugCheck{Status: "not_configured"}
|
||||
}
|
||||
if baseURL == "" {
|
||||
return debugCheck{OK: false, Status: "not_configured", Details: details}
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
checkCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
req, err := http.NewRequestWithContext(checkCtx, http.MethodGet, baseURL, nil)
|
||||
b, err := s.ai.Repo.Budget(ctx)
|
||||
if err != nil {
|
||||
return debugCheck{OK: false, Status: "invalid_url", Error: err.Error(), Details: details}
|
||||
return debugCheck{Status: "database_unavailable"}
|
||||
}
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
profiles, err := s.ai.Repo.Profiles(ctx)
|
||||
if err != nil {
|
||||
return debugCheck{OK: false, Status: "unreachable", Error: err.Error(), DurationMS: time.Since(start).Milliseconds(), Details: details}
|
||||
return debugCheck{Status: "database_unavailable"}
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
ok := resp.StatusCode < 500
|
||||
status := "reachable"
|
||||
if !ok {
|
||||
status = "server_error"
|
||||
active := 0
|
||||
for _, p := range profiles {
|
||||
if p.Enabled && s.ai.Configured(p.Provider) {
|
||||
active++
|
||||
}
|
||||
}
|
||||
return debugCheck{
|
||||
OK: ok,
|
||||
Status: status,
|
||||
HTTPStatus: resp.StatusCode,
|
||||
DurationMS: time.Since(start).Milliseconds(),
|
||||
Details: details,
|
||||
ok := active > 0 && b.MonthlyLimit > 0 && b.MonthCommitted < b.MonthlyLimit && (b.DailyLimit == 0 || b.DayCommitted < b.DailyLimit)
|
||||
status := "setup_required"
|
||||
if ok {
|
||||
status = "configured"
|
||||
}
|
||||
return debugCheck{OK: ok, Status: status, Details: map[string]any{"active_profiles": active, "deepseek_configured": s.ai.Configured("deepseek"), "mistral_configured": s.ai.Configured("mistral"), "budget": b}}
|
||||
}
|
||||
func (s *Server) debugAI(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, 200, map[string]any{"request_id": requestID(r), "ai": s.aiStatus(r.Context())})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user