hex/src/transcription/readiness.rs
Dax 9c1156f20c
models: adopt a found catalog model before anything calls it ready (#2440)
Onboarding and the Windows listener disagreed about a catalog model already in the Hugging Face cache: onboarding, Settings, and the picker decided with is_installed, while the Windows listener also required is_verified, whose receipt only an adopt step writes. Onboarding finished ready and Enable refused with Model required.

One readiness check (models::is_ready) now requires the pinned file check for GGUF. Enable and hex model use reuse the existing installed-only preparation to verify/adopt a file that is here; a model with no file still shows Model required without starting anything, and the picker/onboarding/list scan remains the only scan. Checks never replace a lost import's fallback, Disable cancels an in-flight check, a cancelled check re-evaluates instead of staying on Enabling, macOS keeps permissions in the setup decision and recognition waits for the check, and Linux reports the Verifying stage as checking.
2026-11-22 19:57:26 -05:00

21 lines
1 KiB
Rust

//! One readiness check for a speech model: installed, and for a GGUF file
//! checked against its pinned artifact. Onboarding, Settings, and every
//! listener decide with it, so none of them calls a model ready while another
//! refuses it.
use super::models::{ModelDefinition, ModelRuntime, is_installed, is_verified};
/// Whether `model` can run for `language`: installed, and for a GGUF file
/// checked against its pinned artifact. A file another app downloaded
/// becomes ready once a full check records it (found_models::adopt_catalog).
pub fn is_ready(model: &ModelDefinition, language: &str) -> bool {
is_installed(model, language)
&& (!matches!(model.runtime, ModelRuntime::Gguf(_)) || is_verified(model))
}
/// Whether a model's file is here but not ready yet: Enable can verify and
/// adopt it with the existing installed-only preparation. A model with no
/// file is not a check (it stays "Model required").
pub fn needs_check(model: &ModelDefinition, language: &str) -> bool {
is_installed(model, language) && !is_ready(model, language)
}