Chore: stt reworks [WIP]

This commit is contained in:
Grail Finder
2025-11-09 11:28:50 +03:00
parent 8036bf0081
commit 4a581f6c12
4 changed files with 61 additions and 14 deletions

31
extra/whisper_binary.go Normal file
View File

@@ -0,0 +1,31 @@
package extra
import (
"context"
"gf-lt/config"
"log/slog"
"os/exec"
"sync"
)
type WhisperBinary struct {
whisperPath string
modelPath string
lang string
ctx context.Context
cancel context.CancelFunc
mu sync.Mutex
running bool
cmd *exec.Cmd
}
func NewWhisperBinary(logger *slog.Logger, cfg *config.Config) *WhisperBinary {
ctx, cancel := context.WithCancel(context.Background())
return &WhisperBinary{
whisperPath: cfg.WhisperBinaryPath,
modelPath: cfg.WhisperModelPath,
lang: cfg.STT_LANG,
ctx: ctx,
cancel: cancel,
}
}