config: add threads auto-detection and whisper-cpp validation

This commit is contained in:
leonardotrapani
2026-02-01 01:16:46 +01:00
parent af0a55dc4b
commit a760198a73
5 changed files with 200 additions and 2 deletions
+13
View File
@@ -5,6 +5,7 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"time"
"github.com/BurntSushi/toml"
@@ -76,11 +77,23 @@ func Load() (*Config, error) {
}
config.applyLLMDefaults()
config.applyThreadsDefault()
log.Printf("Config: configuration loaded successfully")
return &config, nil
}
// applyThreadsDefault sets default threads for local transcription if not explicitly set
func (c *Config) applyThreadsDefault() {
if c.Transcription.Threads == 0 {
threads := runtime.NumCPU() - 1
if threads < 1 {
threads = 1
}
c.Transcription.Threads = threads
}
}
// migrateTranscriptionAPIKey migrates old transcription.api_key to providers map
func (c *Config) migrateTranscriptionAPIKey(apiKey string) {
if c.Providers == nil {