add whisper model management for local transcription

This commit is contained in:
leonardotrapani
2026-02-01 01:08:08 +01:00
parent 3b946bac98
commit 7a68e6fda9
5 changed files with 580 additions and 1 deletions
+18
View File
@@ -166,4 +166,22 @@ Started: Sun Feb 1 12:22:47 AM CET 2026
- CheckWhisperCli() uses exec.LookPath, tries --version (whisper-cli doesn't support it, but handles gracefully)
- CheckFFmpeg() same pattern, version extraction works
- Both return Installed=false when binary not found, no errors thrown
- All tests passing, typecheck passes
### Task 19: Create whisper model info and download management
- Created `internal/models/whisper/models.go`
- ModelInfo struct: ID, Name, Filename, Size, SizeBytes, Multilingual
- 9 models: 4 english-only (tiny.en, base.en, small.en, medium.en) + 5 multilingual (tiny, base, small, medium, large-v3)
- GetModelsDir() returns `~/.local/share/hyprvoice/models/whisper/` (expanded)
- GetModelPath(name) returns full path to model file
- GetDownloadURL(name) returns HuggingFace URL
- GetModel(id) returns ModelInfo pointer
- ListModels(), ListMultilingualModels(), ListEnglishOnlyModels() helpers
- Created `internal/models/whisper/registry.go`
- IsInstalled(modelID) checks if model file exists
- ListInstalled() returns all installed model IDs
- Download(ctx, modelID, progressFn) downloads from HuggingFace with progress callback
- Remove(modelID) deletes model file
- GetInstalledPath(modelID) returns path or error if not installed
- Download uses temp file + rename for atomicity, respects context cancellation
- All tests passing, typecheck passes