useModelManagement hook provides a complete interface for managing Whisper, Parakeet, and Soniox speech recognition models.
Import
Usage
Options
string
default:"main"
Window ID for event coordination (ensures events are only processed once)
boolean
default:"true"
Display toast notifications for downloads, errors, etc.
Return Values
models
Type:Record<string, ModelInfo>
Object mapping model names to their information.
ModelInfo Interface:
modelOrder
Type:string[]
Array of model names sorted by accuracy score (highest to lowest).
Usage:
downloadProgress
Type:Record<string, number>
Object mapping model names to download progress (0-100).
Usage:
verifyingModels
Type:Set<string>
Set of model names currently being verified after download.
Usage:
isLoading
Type:boolean
Whether the initial model list is loading.
Usage:
Actions
loadModels
Type:() => Promise<ModelInfo[]>
Refresh the model list from the backend.
Usage:
downloadModel
Type:(modelName: string) => Promise<void>
Start downloading a model.
Parameters:
string
required
Model to download (e.g.,
"base.en", "parakeet-1.0")- Checks if model is already downloading (prevents duplicates)
- Sets initial progress to 0
- Invokes
download_modelcommand (non-blocking) - Progress updates come via
download-progressevents - Completion triggers
model-downloadedevent and reloads model list
cancelDownload
Type:(modelName: string) => Promise<void>
Cancel an in-progress download.
Parameters:
string
required
Model to cancel
deleteModel
Type:(modelName: string) => Promise<void>
Delete a downloaded model with confirmation dialog.
Parameters:
string
required
Model to delete
- Shows confirmation dialog (“Are you sure…?”)
- If confirmed, invokes
delete_modelcommand - Refreshes model list on success
Utilities
sortedModels
Type:[string, ModelInfo][]
Array of [modelName, modelInfo] tuples sorted by accuracy.
Usage:
sortModels (exported function)
Type:(models: [string, ModelInfo][], sortBy: SortCriteria) => [string, ModelInfo][]
Events Handled
The hook automatically subscribes to these backend events:download-progress
Payload:downloadProgress[model] with latest percentage.
model-verifying
Payload:- Sets progress to 100%
- Adds model to
verifyingModelsset - Removes from
downloadProgressafter 500ms
model-downloaded
Payload:- Removes from
downloadProgressandverifyingModels - Refreshes model list
- Shows success toast (if enabled)
download-cancelled
Payload:- Removes from
downloadProgress - Shows info toast (if enabled)
Component Examples
Model Download Card
Filtered Model List
TypeScript Types
See Also
- Model Commands - Backend model operations
- Settings Commands - Model selection
- Audio Commands - Using models for transcription