Make Voxtral the only transcription provider
This commit is contained in:
@@ -8,13 +8,12 @@ import (
|
||||
)
|
||||
|
||||
type dashboardResponse struct {
|
||||
At time.Time `json:"at"`
|
||||
Summary dashboardSummary `json:"summary"`
|
||||
Stats *model.Stats `json:"stats"`
|
||||
Providers providersStatusResponse `json:"providers"`
|
||||
Infra infraStatusResponse `json:"infra"`
|
||||
TranscriptionComparison []model.TranscriptionComparisonStat `json:"transcription_comparison"`
|
||||
Jobs []*model.JobSummary `json:"jobs"`
|
||||
At time.Time `json:"at"`
|
||||
Summary dashboardSummary `json:"summary"`
|
||||
Stats *model.Stats `json:"stats"`
|
||||
Providers providersStatusResponse `json:"providers"`
|
||||
Infra infraStatusResponse `json:"infra"`
|
||||
Jobs []*model.JobSummary `json:"jobs"`
|
||||
}
|
||||
|
||||
type dashboardSummary struct {
|
||||
@@ -44,12 +43,6 @@ func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
comparison, err := s.store.TranscriptionComparison(ctx)
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp := dashboardResponse{
|
||||
At: now,
|
||||
Summary: summarizeQueues(stats),
|
||||
@@ -58,14 +51,11 @@ func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) {
|
||||
At: now,
|
||||
Providers: []providerStatus{
|
||||
s.checkLLM(ctx),
|
||||
s.checkWhisperX(ctx),
|
||||
s.checkAudioLLM(ctx, "qwen2-audio", s.cfg.QwenAudioBaseURL, s.cfg.QwenAudioAPIKey, s.cfg.QwenAudioModel, s.cfg.QwenAudioTimeout),
|
||||
s.checkAudioLLM(ctx, "voxtral-small", s.cfg.VoxtralBaseURL, s.cfg.VoxtralAPIKey, s.cfg.VoxtralModel, s.cfg.VoxtralTimeout),
|
||||
},
|
||||
},
|
||||
Infra: loadInfraSnapshot(r, s.cfg),
|
||||
TranscriptionComparison: comparison,
|
||||
Jobs: jobs,
|
||||
Infra: loadInfraSnapshot(r, s.cfg),
|
||||
Jobs: jobs,
|
||||
}
|
||||
writeJSON(w, http.StatusOK, resp)
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ func (s *Server) handleProviderStatus(w http.ResponseWriter, r *http.Request) {
|
||||
At: time.Now().UTC(),
|
||||
Providers: []providerStatus{
|
||||
s.checkLLM(ctx),
|
||||
s.checkWhisperX(ctx),
|
||||
s.checkAudioLLM(ctx, "qwen2-audio", s.cfg.QwenAudioBaseURL, s.cfg.QwenAudioAPIKey, s.cfg.QwenAudioModel, s.cfg.QwenAudioTimeout),
|
||||
s.checkAudioLLM(ctx, "voxtral-small", s.cfg.VoxtralBaseURL, s.cfg.VoxtralAPIKey, s.cfg.VoxtralModel, s.cfg.VoxtralTimeout),
|
||||
},
|
||||
}
|
||||
@@ -132,47 +130,6 @@ func (s *Server) checkLLM(ctx context.Context) providerStatus {
|
||||
return st
|
||||
}
|
||||
|
||||
func (s *Server) checkWhisperX(ctx context.Context) providerStatus {
|
||||
baseURL := strings.TrimRight(strings.TrimSpace(s.cfg.WhisperXURL), "/")
|
||||
st := providerStatus{Name: "whisperx", Configured: baseURL != "", URL: baseURL}
|
||||
if !st.Configured {
|
||||
return st
|
||||
}
|
||||
paths := []string{"/health", "/healthz", "/readyz", "/"}
|
||||
var lastErr string
|
||||
for _, path := range paths {
|
||||
cctx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||
start := time.Now()
|
||||
req, err := http.NewRequestWithContext(cctx, http.MethodGet, baseURL+path, nil)
|
||||
if err != nil {
|
||||
cancel()
|
||||
lastErr = err.Error()
|
||||
continue
|
||||
}
|
||||
res, err := (&http.Client{Timeout: 2 * time.Second}).Do(req)
|
||||
st.LatencyMS = time.Since(start).Milliseconds()
|
||||
cancel()
|
||||
if err != nil {
|
||||
lastErr = err.Error()
|
||||
continue
|
||||
}
|
||||
body := ""
|
||||
if res.StatusCode >= 300 {
|
||||
body = readSmallBody(res.Body)
|
||||
}
|
||||
_ = res.Body.Close()
|
||||
if res.StatusCode >= 300 {
|
||||
lastErr = fmt.Sprintf("%s http %d: %s", path, res.StatusCode, body)
|
||||
continue
|
||||
}
|
||||
st.OK = true
|
||||
s.rememberProviderOK("whisperx", st.LatencyMS)
|
||||
return st
|
||||
}
|
||||
st.Error = lastErr
|
||||
return s.withStaleProviderOK("whisperx", st)
|
||||
}
|
||||
|
||||
func (s *Server) rememberProviderOK(name string, latencyMS int64) {
|
||||
s.providerMu.Lock()
|
||||
defer s.providerMu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user