admin b5c083e06f
Some checks failed
CodeQL / Analyze (go) (push) Successful in 6m28s
Docker Image / build-docker (push) Failing after 13m26s
Lint and Testing / lint (push) Successful in 11m17s
Lint and Testing / test (push) Successful in 11m17s
Lint and Testing / golangci (push) Successful in 2m40s
first commit
2026-06-04 18:10:52 +07:00

43 lines
1.6 KiB
Go

package config
import "strings"
type API struct {
Addr string `yaml:"addr"`
ModelsDir string `yaml:"models_dir"`
CacheDir string `yaml:"cache_dir"`
// DefaultModel: whisper model id for OpenAI /v1/audio/transcriptions (maps whisper-1).
DefaultModel string `yaml:"default_model"`
Language string `yaml:"language"`
Transcript Transcript `yaml:"transcript"`
DefaultSpeakers bool `yaml:"default_speakers"`
Prompt string `yaml:"prompt"`
Threads uint `yaml:"threads"`
MaxContext uint `yaml:"max_context"`
BeamSize uint `yaml:"beam_size"`
EntropyThold float64 `yaml:"entropy_thold"`
VAD VAD `yaml:"vad"`
Debug bool `yaml:"debug"`
SpeedUp bool `yaml:"speedup"`
Translate bool `yaml:"translate"`
DefaultPunctuation bool `yaml:"default_punctuation"`
// DefaultAsync: STT via API enqueues to cache/waiting and returns taskID (use ?async=0 for sync).
DefaultAsync bool `yaml:"default_async"`
// Garbage: artifact substrings removed from transcript text and words (default includes *выбая*).
Garbage []string `yaml:"garbage"`
}
func (a API) WithDefaults() API {
a.VAD = a.VAD.WithDefaults()
a.Transcript = a.Transcript.WithDefaults()
if strings.TrimSpace(a.Language) == "" {
a.Language = "ru"
}
return a
}
// GarbagePatterns returns garbage filter list (never empty unless explicitly set to [] in YAML).
func (a API) GarbagePatterns() []string {
return a.garbagePatterns()
}