Files
Maven/internal/worker/jobs.go
T
kami d52f60c54e maven: fix test mocks for CalendarEvents interface (verification)
- Add CalendarEvents method to recordingAPI in auth_test.go
- Add CalendarEvents method to fakeCore in handlers_test.go

Co-Authored-By: opencode <opencode@anthropic.com>
2026-07-06 04:20:16 +04:00

55 lines
2.3 KiB
Go

// worker/jobs.go — the two verb payloads (Transcribe + Synthesize).
//
// Audio bytes are base64-encoded by encoding/json automatically via the
// []byte type — the wire shape is a string field carrying base64. Local
// unix socket ⇒ expansion cost is invisible; the JSON envelope stays
// debuggable per the package doc.
//
// Input shape (Transcribe): core has captured audio (push-to-talk) or
// synthesised it (TTS round-trip test path — non-production). The worker
// module consumes audio bytes with the declared Format. Lang is a hint
// ("ru"/"en"/"mixed"); faster-whisper is multilingual and treats the hint
// as a soft bias, vosk ru ignores it (one-model, one-language). The reference
// stt stub ignores all params and returns a canned phrase so the loop is
// exercisable without a model on disk.
//
// Output shape (Transcribe): Text is the recognized string. Confidence is
// the model's own estimate when available; 0 ⇒ unknown. The router downstream
// does its own confidence scoring (the cosine-sim classifier), so worker-side
// confidence is for logging/gating, not for routing.
//
// Input shape (Synthesize): text to render. Lang is the requested voice
// language ("ru"/"en"). Voice ID is a named voice when supported, "" ⇒ the
// worker's configured default. Speed is a 1.0 = normal multiplier; out of
// range is clamped by the worker, not the caller.
//
// Output shape (Synthesize): Audio is the rendered PCM bytes in Format.
package worker
import "github.com/kami/maven/internal/audio"
// TranscribeReq — the transcribe verb args.
type TranscribeReq struct {
Audio audio.Audio `json:"audio"` // capture bytes (raw PCM, format declared)
Lang string `json:"lang"` // "ru" | "en" | "mixed" | "" ⇒ module default
}
// TranscribeResp — the transcribe verb result.
type TranscribeResp struct {
Text string `json:"text"`
Confidence float64 `json:"confidence,omitempty"` // 0 ⇒ unknown
}
// SynthesizeReq — the synthesize verb args.
type SynthesizeReq struct {
Text string `json:"text"`
Lang string `json:"lang"` // "ru" | "en" | ""
Voice string `json:"voice"` // named voice or "" ⇒ worker default
Speed float64 `json:"speed"` // 1.0 = normal; clamped server-side
}
// SynthesizeResp — the synthesize verb result.
type SynthesizeResp struct {
Audio audio.Audio `json:"audio"` // rendered PCM
}