4.0 KiB
Speech configuration and adapter development
Handbook · Agent setup · Video learning
TTS (speech synthesis) and STT (speech recognition) have their own provider profiles and defaults in Speech settings, independently of the chat model.
Configure and verify
- Select an implemented provider and supply its endpoint, exact model/resource ID and credential type.
- Discover voices through the provider when supported. Voice IDs are not a permanent bundled catalog; account-specific voices and model IDs remain editable. A listed voice does not prove account entitlement.
- Choose language, format and other options supported by that model family.
- Preview a short sample, then save/select the default. Preview uses the current form without changing the saved default.
- Verify actual read-aloud or transcription after saving. Model-list success alone does not prove speech synthesis or recognition works.
Chat and selected-text read-aloud can reuse a completed audio file for the same account, spoken text and speech settings for up to 30 minutes. Each server process holds at most 64 files and 32 MiB of audio in memory. Settings previews and connection checks send a fresh request to the provider.
Preview invokes the provider and may incur usage. Form changes invalidate the old preview; an in-flight preview can be cancelled. Request timeout accepts 5–600 seconds, defaulting to 60. Short samples help isolate configuration errors.
Provider boundaries
- Volcengine Speech: Speech credentials differ from Ark LLM keys. The adapter accepts Speech API Key authentication and the older App ID/access-token form. Match TTS resource and voice family. When Web Audio is available, the chat speaker plays the first audio chunk while the rest of the reply is still being synthesized. The whole reply uses one speech request. Selected text and settings previews use the configured file format. STT uses a recording-file API; audio normalization may require system FFmpeg.
- Aliyun DashScope: Qwen3 TTS and Qwen-Audio TTS have distinct native endpoints and parameters. The adapter normalizes supported official compatible-mode bases; a private endpoint must implement the selected protocol. Match key and endpoint region. Confirm voices through discovery and actual preview instead of assuming an old example remains available.
- Other adapters: a compatible chat endpoint does not establish a compatible speech API. Model options and live discovery determine supported voices and formats.
Preserve distinct authentication, region/model, permission, rate-limit, timeout and audio-download errors without exposing credential-bearing responses. Retain cancellation and configured timeouts rather than adding unbounded retries.
Reading elementary math in Chinese
Enable Math speak and select Chinese as the TTS model's language to hear
worksheet arithmetic and fractions in Chinese, including “四分之三” for \frac{3}{4}.
With the language set to Auto or left unset, a worksheet prompt such as “算一算”
also selects Chinese wording, while a formula alone keeps the default reading.
Source map
| Responsibility | Implementation |
|---|---|
| Profiles and resolution | voice/config.py |
| Model/parameter hints | voice/options.py |
| Voice discovery | voice/discovery.py |
| Preview | voice/preview.py |
| Provider protocols | voice/adapters/ |
| Audio conversion | voice/audio.py |
When adding an adapter, test credential handling, endpoint normalization, decoding, timeout/cancellation and error redaction. Report live checks separately from mocked protocol tests. Provider catalogs, availability and billing remain external to this repository.