Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

fix: gate whisper run extension on model arch, not Feature::InitialPrompt (#1603)

Bto Aldasf96a7afb285c
diff --git a/src-tauri/src/managers/transcription.rs b/src-tauri/src/managers/transcription.rs
index e2bd6ff9..743531fc 100644
--- a/src-tauri/src/managers/transcription.rs
+++ b/src-tauri/src/managers/transcription.rs
@@ -1152,10 +1152,18 @@ impl TranscriptionManager {
);
}
- // Whether the loaded transcribe-cpp model accepts a decode prompt
- // (whisper family). Gates the whisper-only run extension below, and
- // whether fuzzy custom-word correction still runs afterwards.
+ // Whether the loaded transcribe-cpp model advertises
+ // Feature::InitialPrompt. Informational (logged below); the whisper
+ // run extension and the fuzzy-correction skip are gated on
+ // `model_is_whisper` instead, since non-whisper archs can advertise
+ // the feature while rejecting the whisper-kind extension.
let mut model_takes_initial_prompt = false;
+ // Whether the loaded model is actually whisper-family (arch string).
+ // Non-whisper archs (e.g. Voxtral Small) can advertise
+ // Feature::InitialPrompt yet reject the whisper-kind run extension
+ // with INVALID_ARG, so the whisper extension must be gated on the
+ // arch, not on the feature (see #1601).
+ let mut model_is_whisper = false;
// Perform transcription with the appropriate engine.
// We use catch_unwind to prevent engine panics from poisoning the mutex,
@@ -1189,6 +1197,7 @@ impl TranscriptionManager {
let model = session.model();
let caps = model.capabilities();
model_takes_initial_prompt = model.supports(Feature::InitialPrompt);
+ model_is_whisper = model.arch() == "whisper";
model_supports_translate = caps.supports_translate;
model_languages = caps.languages;
debug!(
@@ -1210,7 +1219,7 @@ impl TranscriptionManager {
// with INVALID_ARG, so skip it there and let the fuzzy
// post-correction handle custom words instead.
let family =
- if settings.custom_words.is_empty() || !model_takes_initial_prompt {
+ if settings.custom_words.is_empty() || !model_is_whisper {
None
} else {
Some(RunExtension::Whisper(WhisperRunOptions {
@@ -1375,10 +1384,11 @@ impl TranscriptionManager {
// Apply fuzzy word correction if custom words are configured — UNLESS the
// words were already handed to the model as an initial prompt (whisper
- // family). Non-whisper transcribe-cpp models can't take a prompt, so they
- // still get fuzzy correction here, same as the ONNX engines.
+ // family). We don't pass a prompt to non-whisper models (it requires the
+ // whisper-kind run extension), so they still get fuzzy correction here,
+ // same as the ONNX engines.
let filtered_result =
- post_process_transcription_text(result, &settings, model_takes_initial_prompt);
+ post_process_transcription_text(result, &settings, model_is_whisper);
let et = std::time::Instant::now();
let translation_note = if settings.translate_to_english {