Make Voxtral the only transcription provider
This commit is contained in:
@@ -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