Skip to content

feat(server): voice models reuse copies already on disk - #34096

Merged
juliusmarminge merged 3 commits into
mainfrom
t3/reuse-existing-speech-models
Nov 11, 2026
Merged

juliusmarminge merged 3 commits into
mainfrom
t3/reuse-existing-speech-models

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Problem

Every app that ships local speech-to-text downloads its own copy of the same models. T3 Code always fetched from Hugging Face into its own folder, even when the identical file was already on the machine.

Fix

  • Download looks first. Before fetching, the model store checks Handy's models folder and the Hugging Face cache for the pinned file and links it instead of downloading.
  • Use existing. Settings → Voice has a path field under the model list. Paste a model file or a folder; the server searches it (five levels deep) and links every catalog model it finds.
  • Only catalog files. A candidate must match a catalog model's size and SHA-256, so the store still never loads a file the catalog does not pin. Other formats (Core ML, ONNX, MLX) are not usable.
  • No copy. A match is installed as a symlink, with a hard-link fallback where symlinks are not allowed.
  • Way out. A linked model shows the file it uses, and its delete button becomes unlink. Removing it deletes only the link.

Older servers do not report supportsModelLinking, so the path field is hidden for them. Mobile has no path field; linked models appear there as installed and can be selected.

Evidence

Before: the model list with the new path field.

Before

After linking a folder that holds Moonshine Tiny:

After

Live run on a dev server: linked a real 34 MB model from a separate folder, POST /api/voice/models/prepare returned 200 with the native engine loading through the link, and unlinking left the original file in place. The Windows hard-link fallback was not exercised.

Tests: two new cases in SpeechModelStore.test.ts (link from a folder, and Download using a Hugging Face cache copy with zero requests).

Claude Fable 5.2 in Claude Code.

🤖 Generated with Claude Code

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant