Skip to content

fix(tts): fall back to ~/.infer/models/tts/samples for bare voice sample names - #1175

Merged
edenreich merged 2 commits into
mainfrom
fix/issue-1174
Sep 4, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/issue-1174

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

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.

…ple names

A voice_sample that is not found in the working directory is now looked up in the desktop voice samples library (~/.infer/models/tts/samples), so samples uploaded via the desktop work end to end. Absolute and cwd-relative sample paths resolve exactly as before, and a sample found nowhere fails with an error naming both paths tried.

Resolves #1174
@edenreich
edenreich merged commit 79d9ee0 into main Sep 4, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1174 branch September 4, 2026 11:32
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.189.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] TextToSpeech: resolve bare sample names against ~/.infer/models/tts/samples/

1 participant