25 lines
1.2 KiB
Go
25 lines
1.2 KiB
Go
// worker/handler.go — the worker-side seam. A module process implements
|
|
// either Transcriber or Synthesizer (rarely both — stt and tts are
|
|
// independent units with independent model weights and restart lifecycles).
|
|
// Server dispatches a Method to the matching handler.
|
|
package worker
|
|
|
|
import "context"
|
|
|
|
// Transcriber — the stt module's contract. Implementations:
|
|
// - the daemon's in-process Stub (built-in stt stub handler, for tests +
|
|
// for the "no models on disk yet" floor; the daemon decides which to wire
|
|
// from config),
|
|
// - a real faster-whisper / vosk process's main (cmd/mavsttd/main.go today
|
|
// ships the Stub handler; production swaps in onnxruntime-backed code in
|
|
// that same main, no worker-package change).
|
|
type Transcriber interface {
|
|
Transcribe(ctx context.Context, req TranscribeReq) (TranscribeResp, error)
|
|
}
|
|
|
|
// Synthesizer — the tts module's contract. Mirrors Transcriber (separate
|
|
// interface so the two modules can be in separate packages / binaries, and
|
|
// so a server asked for the wrong verb refuses cleanly).
|
|
type Synthesizer interface {
|
|
Synthesize(ctx context.Context, req SynthesizeReq) (SynthesizeResp, error)
|
|
} |