Repository navigation
feat(tts): text-to-speech toggle, transcript playback, voice samples library - #188
Merged
Merged
Conversation
8 tasks
inference-gateway-maintainer
Bot
marked this pull request as ready for review
September 2, 2026 00:50
edenreich
reviewed
Sep 2, 2026
edenreich
added a commit
to inference-gateway/cli
that referenced
this pull request
Sep 4, 2026
…ple names (#1175) Resolves #1174 ## Summary `TextToSpeech.resolveSamplePath` now falls back to the desktop voice samples library (`~/.infer/models/tts/samples/<name>`) when a bare `voice_sample` name is not found in the working directory, so WAV samples uploaded through the desktop samples library (inference-gateway/desktop#188) work end to end without desktop-side changes. Absolute paths and paths containing separators keep resolving exactly as before (still rejected by the bare-name guard), and a sample that resolves nowhere fails with a clear error naming both paths tried. ## Changes - `internal/agent/tools/text_to_speech.go`: `resolveSamplePath` keeps the sandbox-validated working-directory lookup as the primary candidate, then tries `<samples>/<name>`; the new `voiceSamplesDir()` helper resolves `~/.infer/models/tts/samples` from `os.UserHomeDir()` + `config.ConfigDirName`, mirroring the TTS models dir default in `internal/audio/ttsmodel.go`. - Sandbox validation stays on the working-directory candidate only - the samples library is a fixed, desktop-managed directory under `$HOME/.infer` reached only via an already-guarded bare file name. - A miss on both candidates returns `voice_sample %q not found as a readable WAV file (tried: <cwd path>, <samples path>)`. - Updated the `voice_sample` tool parameter description so models know bare names may reference the samples library. - Tests: new `TestTextToSpeechTool_SamplePathFallback` (cwd sample takes precedence, bare name falls back to the samples library, miss errors naming both paths); pinned `HOME` in `TestTextToSpeechTool_Validate` so bare-name resolution stays hermetic. ## Checks - `go test ./internal/agent/tools/`, `task fmt`, `task vet` and the pre-commit gate (mod tidy, import-alias lint, golangci-lint 0 issues, markdownlint) all pass. --------- Co-authored-by: inference-gateway-maintainer[bot] <246577062+inference-gateway-maintainer[bot]@users.noreply.github.com> Co-authored-by: Eden Reich <[email protected]>
Contributor
Author
|
🎉 This PR is included in version 0.29.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #186
Summary
Surfaces the infer CLI's existing Text-to-Speech stack in the desktop instead of implementing synthesis here: a Settings toggle writes
text_to_speech.enabledthrough the existingmerge_configpath, the desktop-owned gateway is spawned withAUDIO_ENABLED=true+AUDIO_LOCAL_AUTO_DOWNLOAD=trueonly when the toggle is on, generated WAVs render as inline<audio controls>players in the transcript via the Tauri asset protocol, and a new "Voice samples" settings tab manages WAV reference recordings for voice cloning in~/.infer/models/tts/samples/(upload via the native file picker,std::fs::copy, preview and delete).Changes
Settings toggle (
backend/src/config.rs):DesktopConfig.text_to_speech_enabledreads/writestext_to_speech.enabled(bool round-trip; CLI-managed keys likeengine/output_dirin the section pass through untouched, matching thetools.schedulepattern).Gateway env (
backend/src/gateway.rs):spawn_gatewaynow appliesaudio_env(read_config().text_to_speech_enabled)next toENABLE_IMAGES=true; env is read at spawn, so toggling takes effect via the existing gateway-restart path (the General tab triggersstart_gateway(restart)when the toggle changed on save).Voice samples commands (
backend/src/tts_samples.rs, registered inlib.rs):list_voice_samples(non-recursive.wavlisting, dir created on first use),add_voice_sample(Rust-sidetauri-plugin-dialogblocking_pick_fileinspawn_blocking, rejects non-.wav, copies under the base name overwriting duplicates),delete_voice_sample(bare names only; separators/../NUL rejected). Notauri-plugin-fs, no HTML file input.Asset protocol (
backend/tauri.conf.json): scope extended with~/.infer/tts/**(CLI default TTS output dir) and~/.infer/models/tts/samples/**plus the$HOME/**/.infer/...variants.Frontend (separate commit):
safeAudioSrcpath guard mirroringsafeImageSrc, transcriptaudioitem rendered as<audio controls>, TTS checkbox in General settings, Voice samples tab, API client additions.No synthesis code, model downloads, or audio binaries added — the CLI and gateway own all of it.
Voice recording: the Voice samples tab can also record a sample in-app (getUserMedia capture at the native sample rate, encoded with the existing
encodeWav, saved via a newsave_voice_samplecommand - name-validated,.wavonly).Tooling: infer pinned to v0.189.1, which ships the sample-name resolution fallback ([FEATURE] TextToSpeech: resolve bare sample names against ~/.infer/models/tts/samples/ cli#1174), so cloning by uploaded/recorded sample name works end-to-end.
Follow-up
Cross-repo impact