Documentation
¶
Overview ¶
Package sttproxy implements the /v1/audio/transcriptions pipeline for the Go rewrite. It ports src/sse/handlers/stt.js (handleStt) + open-sse/handlers/sttCore.js (handleSttCore): parse the multipart form, resolve the provider's static STT config, dispatch by format (deepgram raw-binary, assemblyai upload→submit→poll, gemini generateContent, openai-compatible multipart passthrough), and return either the reshaped { "text": "..." } JSON or the raw upstream body for the OpenAI-compatible case (which forwards response_format unchanged).
NOT in this MVP slice (separate slices, mirroring the video/fetch scope): the multi-account fallback rotation loop (excludeConnectionIds), usage persistence (the legacy STT path never persisted usage), and on-401 token refresh. x-9gouter-connection-id is NOT returned by STT (the JS handler does not echo it — unlike video). The provider is resolved at the handler from body.model (provider/model prefix) and passed in as ProviderID.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies struct {
// HTTPClient performs upstream calls. Defaults to a 300s-timeout client
// (matching the JS maxDuration=300 for large audio uploads).
HTTPClient *http.Client
Logger Logger
Config config.Config
}
Dependencies wires the sttproxy Handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler runs the STT pipeline.
type Logger ¶
type Logger interface {
Infof(format string, args ...any)
Warnf(format string, args ...any)
Debugf(format string, args ...any)
}
Logger is a minimal log sink.
type Request ¶
type Request struct {
Ctx context.Context
ProviderID string
Model string
// File is the uploaded audio bytes.
File []byte
// Filename is the upload filename (may be empty; defaults to "audio.wav").
Filename string
// FileMIME is the browser-provided MIME (may be empty; resolved from ext).
FileMIME string
// FormFields are the non-file multipart fields (model, language, prompt,
// response_format, temperature, timestamp_granularities, ...).
FormFields map[string]string
Credentials domainProv.Credentials
UserAgent string
}
Request is the input to Handle.