Files
viettranx 04a9938f4f feat(tts): wire tenant timeout + fix Gemini text-only 400
- HTTP synthesize + test-connection now read tenant tts.timeout_ms
  (default 120s, was hardcoded 15s/10s). Gemini client default also
  bumped 30s→120s so both layers align when tenant config unset.
- Inline prefix "Speak naturally: " prepended to single-voice text;
  multi-speaker transcripts pass through unchanged.
- ErrTextOnlyResponse sentinel for 400 "text generation" bodies;
  single-voice retries once with stronger prefix. Narrowed needle
  list avoids false positives on unrelated 400s.
- SynthesizeWithFallbackAdapted now returns errors.Join so sentinel
  survives fallback chain; HTTP 422 mapping + locale-translated
  ForLLM in agent tool (EN/VI/ZH catalogs).
- Default Gemini model bumped to gemini-3.1-flash-tts-preview.
2026-04-23 08:31:53 +07:00

20 lines
573 B
Go

package gemini
import "slices"
// geminiModels is the static catalog of supported Gemini TTS model IDs.
// Source: https://ai.google.dev/gemini-api/docs/speech-generation (April 2026)
var geminiModels = []string{
"gemini-3.1-flash-tts-preview",
"gemini-2.5-flash-preview-tts",
"gemini-2.5-pro-preview-tts",
}
// defaultModel is the model used when none is specified.
const defaultModel = "gemini-3.1-flash-tts-preview"
// isValidModel reports whether id is in the static model catalog.
func isValidModel(id string) bool {
return slices.Contains(geminiModels, id)
}