Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: pick the quant of a GGUF dictation model in Voice settings (#12900)
Etherl1cd08cb9a0ea
diff --git a/studio/backend/core/inference/stt_audiocpp_sidecar.py b/studio/backend/core/inference/stt_audiocpp_sidecar.pyindex 0ebdb566363..a727f51bec1 100644--- a/studio/backend/core/inference/stt_audiocpp_sidecar.py+++ b/studio/backend/core/inference/stt_audiocpp_sidecar.py@@ -181,13 +181,20 @@ def resolve_audio_cpp_stt_model(try:require_runnable(found, "asr")except AudioCppModelError as exc:+ # cached rows omit absent quants, so callers treat a selected missing quant as downloadable.+ if not network and (variant or ref_variant):+ row = resolve(base, None, hf_token, network = False)+ if row is not None and row.task == "asr" and row.unsupported is None:+ raise SttModelNotDownloadedError(+ f"STT model '{base}' ({variant or ref_variant}) is not downloaded. Download "+ "it in Settings, then Voice, before loading it."+ ) from excraise SttModelIdError(str(exc)) from excreturn founddef resolve_audio_cpp_stt_model_id(model: Optional[str]) -> str:- """The name dictation reports for ``model``: a legacy key stays that key (Settings compares- against it), anything else becomes its row id."""+ """keeps legacy keys for Settings comparisons; all other names become row ids."""if model is None or not str(model).strip():return DEFAULT_AUDIO_CPP_STT_MODELbase, variant = split_variant_ref(str(model).strip())diff --git a/studio/backend/tests/test_audio_cpp_models.py b/studio/backend/tests/test_audio_cpp_models.pyindex f52be09cd0f..2c03e79ecff 100644--- a/studio/backend/tests/test_audio_cpp_models.py+++ b/studio/backend/tests/test_audio_cpp_models.py@@ -2084,10 +2084,22 @@ def test_stt_takes_the_variant_keys_gguf_variants_lists_even_from_a_partial_cachassert s.resolve_audio_cpp_stt_model(f"{folder}:small/Q8_0").variant.key == "small/Q8_0"assert s.resolve_audio_cpp_stt_model(f"{folder}:small").variant.key == "small/Q8_0"assert s.is_model_downloaded(f"{folder}:small/Q8_0")- # A variant that is not on disk is still refused rather than swapped for another.+ # variants missing from disk are refused instead of replaced by another variant.tiny = acm.resolve(folder, "tiny/Q8_0", network = False)assert "not found" in tiny.unsupported- # A file stem is a spelling of its own row, not a new scope.+ # dictation treats this as a download opportunity, not a bad model id.+ from core.inference.stt_sidecar import SttModelIdError, SttModelNotDownloadedError++ with pytest.raises(SttModelNotDownloadedError, match = r"\(tiny/Q8_0\) is not downloaded"):+ s.resolve_audio_cpp_stt_model(f"{folder}:tiny/Q8_0")+ with pytest.raises(SttModelNotDownloadedError):+ s.resolve_audio_cpp_stt_model(folder, "tiny/Q8_0")+ assert not s.is_model_downloaded(f"{folder}:tiny/Q8_0")+ # another task's folder remains invalid regardless of quant.+ _kokoro(hub)+ with pytest.raises(SttModelIdError):+ s.resolve_audio_cpp_stt_model(f"{AUDIO_CPP_REPO}/Kokoro-82M-GGUF:Q8_0")+ # a file stem names its existing row rather than a new scope.stem = acm.resolve(folder, "moonshine-streaming-small-q8_0", network = False)assert stem.variant.key == "Q8_0" and stem.unsupported is None@@ -2096,7 +2108,7 @@ def test_yue2_length_follows_the_requested_duration():b, srv = _backend_with(_speech_model("yue2"), MUSIC_REPLY)b.generate_audio_response("[chorus] oh", instructions = "rock", max_new_tokens = 125)options = srv.calls[0][1]["request"]["options"]- # 5 s at 25 frames per second, with the default 200-frame floor lowered to fit.+ # 5 s at 25 frames per second, with the 200-frame default lowered to fit.assert options["semantic_max_tokens"] == 125 and options["semantic_min_tokens"] == 125b.generate_audio_response("[chorus] oh", instructions = "rock", max_new_tokens = 1500)options = srv.calls[1][1]["request"]["options"]diff --git a/studio/frontend/src/features/audio/hooks/use-reference-transcribe.ts b/studio/frontend/src/features/audio/hooks/use-reference-transcribe.tsindex 3b6313fc4e5..91eb71474c6 100644--- a/studio/frontend/src/features/audio/hooks/use-reference-transcribe.ts+++ b/studio/frontend/src/features/audio/hooks/use-reference-transcribe.ts@@ -2,14 +2,13 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import { sttEngineFor } from "@/features/chat/adapters/studio-model-dictation-adapter";-import { useVoiceSettingsStore } from "@/features/settings";+import { useVoiceSettingsStore, withSttVariant } from "@/features/settings";import { useCallback, useEffect, useRef, useState } from "react";import { transcribeAudioInput } from "../api";import { type AudioSourceSelection, sourceRefOf } from "../audio-run-request";import { sttEngineForRepoId, sttSidecarKeyFor } from "../catalog";-/** Fills "What's said in the clip" without adding it to the transcript list. No language hint:- * the page's language is the output's, and a cross-lingual reference is not in it. */+/** fills the prompt without a transcript entry or language hint for cross-lingual references. */export function useReferenceTranscribe({sttRepo,onText,@@ -29,7 +28,7 @@ export function useReferenceTranscribe({const transcribe = useCallback(async (reference: AudioSourceSelection | null) => {if (!reference) return;- // A newer clip wins, so its own transcription is never skipped.+ // a newer clip wins so its transcription is never skipped.abort.current?.abort();const controller = new AbortController();abort.current = controller;@@ -41,7 +40,10 @@ export function useReferenceTranscribe({const result = await transcribeAudioInput(sourceRefOf(reference),{- model,+ // the Settings model uses its saved quant; a Transcribe selection is already resident.+ model: sttRepo+ ? model+ : withSttVariant(model, voice.sttGgufVariant),engine: sttRepo ? sttEngineForRepoId(sttRepo) : sttEngineFor(model),device: voice.sttDevice,purpose,diff --git a/studio/frontend/src/features/chat/adapters/studio-dictation-adapter.tsx b/studio/frontend/src/features/chat/adapters/studio-dictation-adapter.tsxindex b3ca0f62f6a..00de2a576c3 100644--- a/studio/frontend/src/features/chat/adapters/studio-dictation-adapter.tsx+++ b/studio/frontend/src/features/chat/adapters/studio-dictation-adapter.tsx@@ -4,6 +4,7 @@import { requestSttDownload } from "@/features/settings/stores/stt-download-prompt-store";import {type DictationEngine,+ sttModelVariant,useVoiceSettingsStore,} from "@/features/settings/stores/voice-settings-store";import { toast } from "@/lib/toast";@@ -17,18 +18,17 @@ import {StudioModelDictationAdapter,fetchSttStatus,sttEngineStatusFor,+ sttQuantDownloaded,} from "./studio-model-dictation-adapter";import {type StudioDictationSession,StudioWebSpeechDictationAdapter,} from "./studio-web-speech-dictation-adapter";-// The one live dictation session, so Escape can discard it without going through assistant-ui,-// which only exposes stop. Cancelling emits no transcript, so composer text is untouched.-// assistant-ui exposes only stop, i.e. transcribe, which is why Escape needs its own path.+// one live session lets Escape cancel because assistant-ui only exposes stop, which transcribes.let activeSession: StudioDictationSession | null = null;-/** Discard the current dictation without transcribing. Safe to call when idle. */+/** discards the active dictation without transcribing; safe when idle. */export function cancelActiveStudioDictation(): void {const session = activeSession;activeSession = null;@@ -148,25 +148,22 @@ export function notifyStudioDictationUnavailable(return;}if (usesRecordedAudio(dictationEngine)) {- // defensive: media recording is effectively always present here.toast.error("Voice recording isn't available in this browser.");return;}- // Browser Web Speech is missing (e.g. Firefox). Local dictation is the only way to type by- // voice here, so offer it rather than describing it.+ // Firefox lacks Web Speech, so offer local dictation.void offerLocalDictation();}-/** Move a browser with no speech service onto local dictation. Already downloaded means one- * switch; otherwise the same confirmation the mic raises, which flips the engine only if- * accepted. */+/** offers local dictation when Web Speech is missing, prompting before a needed download. */async function offerLocalDictation(): Promise<void> {- const { sttModel, setDictationEngine } = useVoiceSettingsStore.getState();+ const { sttModel, sttGgufVariant, setDictationEngine } =+ useVoiceSettingsStore.getState();+ const ggufVariant = sttModelVariant(sttModel, sttGgufVariant);try {const status = await fetchSttStatus(undefined, sttModel);const engine = sttEngineStatusFor(status, sttModel);- // An engine with no runtime installed cannot load what it downloads, so say what is missing- // rather than asking for gigabytes first.+ // avoid offering a large download when the runtime cannot load it.if (engine && !engine.available) {toast.error("Local transcription isn't installed on this server.", {description:@@ -174,7 +171,10 @@ async function offerLocalDictation(): Promise<void> {});return;}- if (engine?.downloaded_models.includes(sttModel)) {+ if (+ engine?.downloaded_models.includes(sttModel) &&+ (await sttQuantDownloaded(sttModel, ggufVariant))+ ) {setDictationEngine("model");toast.success("Switched to local transcription.", {description:@@ -183,7 +183,7 @@ async function offerLocalDictation(): Promise<void> {return;}} catch {- // Status is unreachable; the download path reports its own failure.+ // the download path reports status or quant lookup failures.}- requestSttDownload(sttModel, { selectLocalEngine: true });+ requestSttDownload(sttModel, { selectLocalEngine: true, ggufVariant });}diff --git a/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts b/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.tsindex e8ebb954036..e530f5b6e05 100644--- a/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts+++ b/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts@@ -7,7 +7,9 @@ import {isAudioCppFolderId,} from "../../audio/audio-cpp-catalog";import { authFetch } from "@/features/auth";+import { listGgufVariants } from "@/features/hub/inventory/api";import { hubTokenHeader } from "@/features/hub/lib/hub-token-header";+import { getHfToken, hfApiToken } from "@/features/hub/stores/hf-token-store";import { useSettingsDialogStore } from "@/features/settings/stores/settings-dialog-store";import { requestSttDownload } from "@/features/settings/stores/stt-download-prompt-store";import {@@ -18,7 +20,10 @@ import {isCuratedSttModel,recordRecentDictation,resolveModelDictationLanguage,+ sttListedQuantDownloaded,+ sttModelVariant,useVoiceSettingsStore,+ withSttVariant,} from "@/features/settings/stores/voice-settings-store";import type { DictationAdapter } from "@assistant-ui/react";import { toast } from "sonner";@@ -29,7 +34,7 @@ import { useExternalProvidersStore } from "../stores/external-providers-store";import { startDictationLevelMeter } from "./dictation-level";import { type SegmentRecorder, createAudioRecorder } from "./pcm-recorder";import { SttModelNotDownloadedError, sttRequestError } from "./stt-errors";-// Re-exported so the one public entry point for dictation is unchanged.+// re-export preserves the public dictation entry pointexport { SttModelNotDownloadedError } from "./stt-errors";import {beginDictationSession,@@ -122,7 +127,6 @@ async function sttErrorDetail(response: Response): Promise<string> {return body?.detail ?? body?.error?.message ?? `HTTP ${response.status}`;}-/** post recorded audio to the selected STT backend and return its transcript. */export async function transcribeAudioBlob(blob: Blob,options: {@@ -130,6 +134,8 @@ export async function transcribeAudioBlob(language?: string;engine?: SttEngine;device?: SttDevice;+ /** package-folder quant; defaults to the saved quant when `model` is also omitted */+ ggufVariant?: string | null;providerId?: string;signal?: AbortSignal;} = {},@@ -193,7 +199,19 @@ export async function transcribeAudioBlob(const language = resolveModelDictationLanguage(model, languageSetting);const engine = options.engine ?? sttEngineFor(model);- const params = new URLSearchParams({ model, fast: "true", engine });+ // cold sidecars resolve bare rows to their default quant, so the pick travels as `row:variant`+ const variant =+ options.ggufVariant !== undefined+ ? options.ggufVariant+ : options.model === undefined+ ? sttModelVariant(model, settings.sttGgufVariant)+ : null;+ const params = new URLSearchParams({+ model:+ engine === "audiocpp" && variant ? withSttVariant(model, variant) : model,+ fast: "true",+ engine,+ });if (language) params.set("language", language);params.set("device", options.device ?? settings.sttDevice);const response = await authFetch(@@ -222,10 +240,9 @@ export interface SttDownloadStatus {downloading: boolean;model: string | null;error: string | null;- /** The last download was stopped by the user rather than failing. */+ /** whether the user stopped the last download */cancelled?: boolean;- /** Which model that cancellation applies to. `model` goes null once the worker thread stops,- * so this is the only way to tell a settled cancellation from an unrelated one. */+ /** cancellation target retained after the worker clears `model` */cancelled_model?: string | null;bytes_total: number | null;bytes_done: number | null;@@ -234,6 +251,8 @@ export interface SttDownloadStatus {export interface SttEngineStatus {available: boolean;loaded_model: string | null;+ /** resident audiocpp quant; absent for other engines */+ loaded_variant?: string | null;loading: boolean;device: string | null;keep_alive_seconds: number;@@ -325,8 +344,20 @@ export async function validateSttModel(}}-/** The quant an audiocpp pick names, as the request field; every other engine takes none. A saved- * dictation key already implies its package, so callers pass nothing for one. */+/** checks the quant because row status is true for any cached quant; unreadable listings defer to it */+export async function sttQuantDownloaded(+ model: string,+ ggufVariant: string | null | undefined,+ signal?: AbortSignal,+): Promise<boolean> {+ if (!ggufVariant) return true;+ const listing = await listGgufVariants(model, hfApiToken(getHfToken()), {+ signal,+ }).catch(() => null);+ return !listing || sttListedQuantDownloaded(listing, ggufVariant);+}++/** sends audiocpp quant picks; saved keys imply a package, and other engines take none */function sttVariantBody(engine: SttEngine,ggufVariant: string | null | undefined,@@ -337,7 +368,6 @@ function sttVariantBody(: {};}-/** Load a selected model that is already downloaded. */export function loadSttModel(model: string,engine?: SttEngine,@@ -494,6 +524,9 @@ export class StudioModelDictationAdapter implements DictationAdapter {const sessionEngine = usesExternalEndpoint? undefined: sttEngineFor(sessionModel);+ const sessionVariant = usesExternalEndpoint+ ? null+ : sttModelVariant(sessionModel, settings.sttGgufVariant);const sessionChatId = resolveDictationChatId(this.chatId);const speechStartCallbacks = new Set<() => void>();@@ -550,13 +583,12 @@ export class StudioModelDictationAdapter implements DictationAdapter {if (reportedTranscriptionError || cancelled || ended) return;reportedTranscriptionError = true;console.error("STT transcription error:", error);- // An undownloaded model is the ordinary first-run state, not a failure. Point at the- // download; never start it here.+ // undownloaded models require confirmation; never download from dictationif (!usesExternalEndpoint &&error instanceof SttModelNotDownloadedError) {- requestSttDownload(sessionModel);+ requestSttDownload(sessionModel, { ggufVariant: sessionVariant });finishSession("cancelled");return;}@@ -570,9 +602,7 @@ export class StudioModelDictationAdapter implements DictationAdapter {onClick: () => useSettingsDialogStore.getState().openDialog("voice"),},});- // The preload runs cache-only, so nothing it reports is transient: a missing runtime or a- // load refused for training means no segment of this session can be transcribed. End it- // rather than let the user keep speaking into a recorder whose audio is already lost.+ // cache-only preload failures make the session unusable, so stop before more audio is lostif (stage === "preload") finishSession("cancelled");};@@ -622,7 +652,7 @@ export class StudioModelDictationAdapter implements DictationAdapter {}};- // Transcribe queued segments one at a time so the backend is never flooded.+ // serialize segment transcription to avoid flooding the backendconst processQueue = () => {if (worker || cancelled || ended) return;const item = queue.shift();@@ -637,14 +667,14 @@ export class StudioModelDictationAdapter implements DictationAdapter {model: sessionModel,language: sessionLanguage,engine: sessionEngine,+ ggufVariant: sessionVariant,providerId: sessionProviderId,signal: abortController.signal,});if (!cancelled) results[item.index] = text;} catch (error) {if (!cancelled && !abortController.signal.aborted) {- // Keep transcribed segments, but never hide that part was lost. Only a lost segment is- // partial: the model preload shares this reporter and can fail without costing any audio.+ // only a lost segment is partial; preload failures cost no recorded audiomarkDictationFailed();reportTranscriptionError(error);}@@ -850,9 +880,15 @@ export class StudioModelDictationAdapter implements DictationAdapter {return;}if (!usesExternalEndpoint && sessionEngine) {- // warm the model only after mic access; the backend never downloads here.- void loadSttModel(sessionModel, sessionEngine).catch(- (error: unknown) => reportTranscriptionError(error, "preload"),+ // warm the model only after mic access; the backend never downloads here+ void loadSttModel(+ sessionModel,+ sessionEngine,+ undefined,+ undefined,+ sessionVariant,+ ).catch((error: unknown) =>+ reportTranscriptionError(error, "preload"),);}stopLevelMeter = startDictationLevelMeter(stream, (rawRms, now) => {diff --git a/studio/frontend/src/features/chat/hooks/use-chat-audio-upload.ts b/studio/frontend/src/features/chat/hooks/use-chat-audio-upload.tsindex e95d151d9d9..93ab2c5b5f5 100644--- a/studio/frontend/src/features/chat/hooks/use-chat-audio-upload.ts+++ b/studio/frontend/src/features/chat/hooks/use-chat-audio-upload.ts@@ -10,6 +10,7 @@ import {applyDictationDictionary,recordRecentDictation,requestSttDownload,+ sttModelVariant,useSettingsDialogStore,useVoiceSettingsStore,} from "@/features/settings";@@ -30,6 +31,7 @@ import {fetchSttStatus,sttEngineFor,sttEngineStatusFor,+ sttQuantDownloaded,transcribeAudioBlob,} from "../adapters/studio-model-dictation-adapter";import { resolveDictationChatId } from "../adapters/studio-web-speech-dictation-adapter";@@ -60,6 +62,8 @@ export type ChatAudioUploadReadiness =interface ChatAudioUploadSnapshot extends ChatAudioUploadFence {model: string;engine: SttEngine;+ /** quant of a package folder model, pinned with it */+ ggufVariant: string | null;language: string;device: "auto" | "cpu";chatId: string | undefined;@@ -89,6 +93,7 @@ export function useChatAudioUpload({}: UseChatAudioUploadOptions) {const t = useT();const model = useVoiceSettingsStore((state) => state.sttModel);+ const ggufVariant = useVoiceSettingsStore((state) => state.sttGgufVariant);const language = useVoiceSettingsStore((state) => state.dictationLanguage);const device = useVoiceSettingsStore((state) => state.sttDevice);const [dialogOpen, setDialogOpen] = useState(false);@@ -165,17 +170,19 @@ export function useChatAudioUpload({return retry? {model: retry.snapshot.model,+ ggufVariant: retry.snapshot.ggufVariant,language: retry.snapshot.language,device: retry.snapshot.device,engine: retry.snapshot.engine,}: {model: model.trim(),+ ggufVariant: sttModelVariant(model.trim(), ggufVariant),language,device,engine: sttEngineFor(model.trim()),};- }, [device, language, model]);+ }, [device, ggufVariant, language, model]);const refreshReadiness = useCallback(async (silent = false) => {@@ -197,6 +204,12 @@ export function useChatAudioUpload({}try {const status = await fetchSttStatus(undefined, targetModel, signal);+ // status tracks rows; a pinned quant is ready only when its own files are+ const quantDownloaded = await sttQuantDownloaded(+ targetModel,+ target.ggufVariant,+ signal,+ );if (!queue.isCurrent(attempt) ||ownerRef.current !== ownerAtStart ||@@ -229,9 +242,11 @@ export function useChatAudioUpload({return;}setReadiness({- state: engineStatus.downloaded_models.includes(targetModel)- ? "ready"- : "missing",+ state:+ engineStatus.downloaded_models.includes(targetModel) &&+ quantDownloaded+ ? "ready"+ : "missing",model: targetModel,});} catch {@@ -285,7 +300,9 @@ export function useChatAudioUpload({}if (readiness.model !== target.model || readiness.state !== "ready") {if (readiness.model === target.model && readiness.state === "missing") {- requestSttDownload(target.model);+ requestSttDownload(target.model, {+ ggufVariant: target.ggufVariant,+ });} else if (readiness.state === "error") {void refreshReadiness();}@@ -299,6 +316,7 @@ export function useChatAudioUpload({authSessionEpoch: getAuthSessionEpoch(),model: target.model,engine: target.engine,+ ggufVariant: target.ggufVariant,language: target.language,device: target.device,chatId: resolveDictationChatId(chatId),@@ -345,6 +363,7 @@ export function useChatAudioUpload({transcribeAudioBlob(file, {model: source.model,engine: source.engine,+ ggufVariant: source.ggufVariant,language: source.language,device: source.device,signal: controller.signal,@@ -371,7 +390,9 @@ export function useChatAudioUpload({if (controller.signal.aborted) return;if (error instanceof SttModelNotDownloadedError) {setReadiness({ state: "missing", model: source.model });- requestSttDownload(source.model);+ requestSttDownload(source.model, {+ ggufVariant: source.ggufVariant,+ });}failure =error instanceof Error && error.message@@ -450,7 +471,9 @@ export function useChatAudioUpload({readiness.model === failed.snapshot.model &&readiness.state === "missing") {- requestSttDownload(failed.snapshot.model);+ requestSttDownload(failed.snapshot.model, {+ ggufVariant: failed.snapshot.ggufVariant,+ });} else {void refreshReadiness();}diff --git a/studio/frontend/src/features/settings/components/stt-download-prompt.tsx b/studio/frontend/src/features/settings/components/stt-download-prompt.tsxindex 4a6b9019b88..b13aab555ac 100644--- a/studio/frontend/src/features/settings/components/stt-download-prompt.tsx+++ b/studio/frontend/src/features/settings/components/stt-download-prompt.tsx@@ -12,12 +12,13 @@ import {AlertDialogMedia,AlertDialogTitle,} from "@/components/ui/alert-dialog";+import { audioCppSizeLabel } from "@/features/audio/audio-cpp-catalog";import { startSttDownload } from "@/features/chat";-import { hfApiToken, useHfTokenStore } from "@/features/hub";+import { hfApiToken, listGgufVariants, useHfTokenStore } from "@/features/hub";import { useT } from "@/i18n";import { MicIcon } from "@/lib/mic-icon";import { toast } from "@/lib/toast";-import type { ReactNode } from "react";+import { type ReactNode, useEffect, useState } from "react";import { trackSttDownload } from "../lib/stt-download-mirror";import {type SttDownloadRequest,@@ -29,7 +30,7 @@ import {useVoiceSettingsStore,} from "../stores/voice-settings-store";-/** Emphasise the model name in translated copy; plain text if absent. */+/** emphasise the model name in translated copy; use plain text if absent */function highlightModel(text: string, model: string): ReactNode {const at = model ? text.indexOf(model) : -1;if (at === -1) return text;@@ -42,25 +43,58 @@ function highlightModel(text: string, model: string): ReactNode {);}-/**- * App-level confirmation for a dictation model download. Mounted once so the- * mic can raise it before Voice settings is ever opened.- */+/** app-level confirmation mounted once so the mic can raise it before Voice settings opens */export function SttDownloadPrompt() {const t = useT();const pending = useSttDownloadPromptStore((s) => s.pending);const dismiss = useSttDownloadPromptStore((s) => s.dismiss);const hfToken = useHfTokenStore((state) => state.token);+ const pendingModel = pending?.model ?? null;+ const variant = pending?.ggufVariant ?? null;+ // a package folder has no curated size, so read its quant's from the cached listing+ const [listedSize, setListedSize] = useState<{+ model: string;+ variant: string | null;+ size: string;+ } | null>(null);+ useEffect(() => {+ if (!pendingModel || sttModelSize(pendingModel)) return;+ let cancelled = false;+ listGgufVariants(pendingModel, hfApiToken(hfToken))+ .then((listing) => {+ const row = listing.variants.find(+ (candidate) =>+ candidate.quant === (variant ?? listing.default_variant),+ );+ if (cancelled || !row) return;+ setListedSize({+ model: pendingModel,+ variant,+ size: audioCppSizeLabel(row.download_size_bytes ?? row.size_bytes),+ });+ })+ .catch(() => {});+ return () => {+ cancelled = true;+ };+ }, [pendingModel, variant, hfToken]);const confirm = async (request: SttDownloadRequest) => {- // Only on accept: a cancel must not leave the engine changed.+ // change the engine only on accept because cancel must leave it unchangedif (request.selectLocalEngine) {useVoiceSettingsStore.getState().setDictationEngine("model");}try {- await startSttDownload(request.model, hfApiToken(hfToken));- // Progress goes to the shared download panel; the model loads itself when it lands.- trackSttDownload(request.model);+ await startSttDownload(+ request.model,+ hfApiToken(hfToken),+ undefined,+ request.ggufVariant,+ );+ // progress uses the shared download panel; the model loads when the download finishes+ trackSttDownload(request.model, {+ ggufVariant: request.ggufVariant ?? null,+ });} catch (error) {toast.error(t("settings.voice.dictation.sttDownloadFailed"), {description: error instanceof Error ? error.message : undefined,@@ -68,8 +102,12 @@ export function SttDownloadPrompt() {}};- const pendingModel = pending?.model ?? null;- const size = pendingModel ? sttModelSize(pendingModel) : "";+ const size = pendingModel+ ? sttModelSize(pendingModel) ||+ (listedSize?.model === pendingModel && listedSize.variant === variant+ ? listedSize.size+ : "")+ : "";return (<AlertDialogopen={pending !== null}@@ -79,8 +117,7 @@ export function SttDownloadPrompt() {><AlertDialogContent><AlertDialogHeader>- {/* The glyph fills its viewBox, unlike the padded hugeicons the- default circle is sized for, so both come down together. */}+ {/* the glyph fills its viewBox, unlike the padded hugeicons, so size both together */}<AlertDialogMedia className="size-12"><MicIcon className="text-muted-foreground size-5" /></AlertDialogMedia>diff --git a/studio/frontend/src/features/settings/index.ts b/studio/frontend/src/features/settings/index.tsindex c135eea2e6f..267a2830d70 100644--- a/studio/frontend/src/features/settings/index.ts+++ b/studio/frontend/src/features/settings/index.ts@@ -117,7 +117,9 @@ export {applyDictationDictionary,recordRecentDictation,sttModelName,+ sttModelVariant,useVoiceSettingsStore,+ withSttVariant,} from "./stores/voice-settings-store";export type { Palette, ResolvedTheme, Theme } from "./stores/theme-store";diff --git a/studio/frontend/src/features/settings/lib/stt-download-mirror.ts b/studio/frontend/src/features/settings/lib/stt-download-mirror.tsindex 41d5750c5e5..290ed5eb6c8 100644--- a/studio/frontend/src/features/settings/lib/stt-download-mirror.ts+++ b/studio/frontend/src/features/settings/lib/stt-download-mirror.ts@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+import { isAudioCppFolderId } from "@/features/audio/audio-cpp-catalog";import {type SttEngine,cancelSttDownload,@@ -11,6 +12,7 @@ import {} from "@/features/chat";import {finishExternalJob,+ invalidateGgufVariantsCache,startExternalJob,updateExternalJob,} from "@/features/hub";@@ -20,6 +22,7 @@ import {type SttModel,getSttModelRepo,sttModelName,+ sttModelVariant,useVoiceSettingsStore,} from "../stores/voice-settings-store";import { SttDownloadTrackers } from "./stt-download-trackers";@@ -37,6 +40,8 @@ const START_GRACE_MS = 8_000;const trackers = new SttDownloadTrackers();const warmSelectedVoiceModelOnComplete = new Map<string, boolean>();+// The quant each tracked download fetches, when its starter knew it.+const trackedVariants = new Map<string, string | null>();function trackerKey(model: SttModel, engine?: SttEngine): string {return engine && engine !== "transformers" ? `${engine}:${model}` : model;@@ -51,9 +56,10 @@ function jobKey(model: SttModel, engine?: SttEngine): string {async function loadAndAnnounce(model: SttModel,engine?: SttEngine,+ ggufVariant?: string | null,): Promise<void> {try {- await loadSttModel(model, engine);+ await loadSttModel(model, engine, undefined, undefined, ggufVariant);toast.success(translate("settings.voice.dictation.sttModelReady", {model: sttModelName(model),@@ -74,21 +80,31 @@ function settle(): void {const key = trackerKey(model, engine);finishExternalJob(jobKey(model, engine), outcome, error);+ // A cached listing would still call the new quant not downloaded.+ if (outcome === "complete" && isAudioCppFolderId(model)) {+ invalidateGgufVariantsCache(model);+ }trackers.stop(key);const shouldWarmVoiceModel =warmSelectedVoiceModelOnComplete.get(key) ?? true;warmSelectedVoiceModelOnComplete.delete(key);- // Only warm what the user is still pointed at. Selecting another model, or- // leaving local dictation, during the download means this one is not wanted- // and loading it would undo the unload that switch performed.- const { sttModel, dictationEngine } = useVoiceSettingsStore.getState();+ const tracked = trackedVariants.get(key);+ trackedVariants.delete(key);+ // Only warm what the user is still pointed at. Selecting another model or+ // quant, or leaving local dictation, during the download means this one is+ // not wanted and loading it would undo the unload that switch performed.+ const { sttModel, sttGgufVariant, dictationEngine } =+ useVoiceSettingsStore.getState();+ const variant = sttModelVariant(model, sttGgufVariant);if (shouldWarmVoiceModel &&outcome === "complete" &&dictationEngine === "model" &&- sttModel === model+ sttModel === model &&+ // An adopted download's quant is unknown; it can only be what an unpinned row runs.+ (tracked === undefined ? variant === null : tracked === variant)) {- void loadAndAnnounce(model, engine);+ void loadAndAnnounce(model, engine, variant);}}@@ -121,11 +137,9 @@ async function poll(return;}- if (engineStatus?.downloaded_models.includes(model)) {- settle(model, "complete", undefined, engine);- return;- }- if (download?.cancelled) {+ // Before the downloaded check: a row lists as downloaded once any quant of it is cached, so a+ // stopped download of another quant would read as complete. start() clears both flags.+ if (download?.cancelled && (download.cancelled_model ?? model) === model) {settle(model, "cancelled", undefined, engine);return;}@@ -133,6 +147,10 @@ async function poll(settle(model, "error", download.error, engine);return;}+ if (engineStatus?.downloaded_models.includes(model)) {+ settle(model, "complete", undefined, engine);+ return;+ }if (Date.now() - startedAt > START_GRACE_MS) {settle(model,@@ -162,6 +180,8 @@ export function trackSttDownload(warmSelectedVoiceModelOnComplete?: boolean;engine?: SttEngine;repoId?: string;+ /** The quant this download fetches, so a quant picked meanwhile is not warmed. */+ ggufVariant?: string | null;} = {},): void {const resolvedEngine = options.engine ?? sttEngineFor(model);@@ -177,6 +197,9 @@ export function trackSttDownload(key,options.warmSelectedVoiceModelOnComplete ?? true,);+ if (options.ggufVariant !== undefined) {+ trackedVariants.set(key, options.ggufVariant);+ }startExternalJob({key: jobKey(model, resolvedEngine),repoId: options.repoId ?? getSttModelRepo(model),diff --git a/studio/frontend/src/features/settings/stores/stt-download-prompt-store.ts b/studio/frontend/src/features/settings/stores/stt-download-prompt-store.tsindex 8196d1b396c..670ddc68c7e 100644--- a/studio/frontend/src/features/settings/stores/stt-download-prompt-store.ts+++ b/studio/frontend/src/features/settings/stores/stt-download-prompt-store.ts@@ -6,19 +6,15 @@ import type { SttModel } from "./voice-settings-store";export interface SttDownloadRequest {model: SttModel;- /** Also switch dictation to local on confirm, for a browser whose speech- * service cannot work at all. Left alone if the user cancels. */+ /** pinned quant for a package folder model. */+ ggufVariant?: string | null;+ /** switches dictation to local only after confirmation when browser speech is unavailable. */selectLocalEngine?: boolean;}-/**- * The one pending "download this dictation model?" confirmation.- *- * A store, not local state, so the mic can raise the dialog without Voice- * settings being open.- */+/** pending download confirmation shared so the mic can open it without Voice settings mounted. */interface SttDownloadPromptState {- /** Request awaiting a yes/no, or null when nothing is asked. */+ /** request awaiting confirmation, or null when idle. */pending: SttDownloadRequest | null;requestDownload: (request: SttDownloadRequest) => void;dismiss: () => void;diff --git a/studio/frontend/src/features/settings/stores/stt-model-catalog.ts b/studio/frontend/src/features/settings/stores/stt-model-catalog.tsindex 4c2061aa6f6..3c4363ea5da 100644--- a/studio/frontend/src/features/settings/stores/stt-model-catalog.ts+++ b/studio/frontend/src/features/settings/stores/stt-model-catalog.ts@@ -166,6 +166,59 @@ export function sttModelName(model: SttModel): string {);}+/** package folder quant; "" uses the resident or default, while saved keys encode their own. */+export function sttModelVariant(+ model: SttModel,+ variant: string,+): string | null {+ return variant && isAudioCppFolderId(model) ? variant : null;+}++/** folds a quant into the audio runtime model id as `row:variant`. */+export function withSttVariant(model: SttModel, variant: string): string {+ const quant = sttModelVariant(model, variant);+ return quant ? `${model}:${quant}` : model;+}++/** picks the pinned, loaded, cached, or default quant; resolves loose cache keys like `Q8_0`. */+export function sttShownVariant(+ pinned: string | null,+ loaded: string | null,+ listing: {+ default_variant: string | null;+ variants: readonly { quant: string; downloaded?: boolean }[];+ } | null,+): string | null {+ if (pinned) return pinned;+ if (!listing) return loaded;+ if (loaded) {+ if (listing.variants.some((variant) => variant.quant === loaded)) {+ return loaded;+ }+ const scoped = listing.variants.filter(+ (variant) => variant.downloaded && variant.quant.endsWith(`/${loaded}`),+ );+ if (scoped.length === 1) return scoped[0].quant;+ }+ return (+ listing.variants.find((variant) => variant.downloaded)?.quant ??+ listing.default_variant+ );+}++/** Whether a listing leaves the pinned quant possibly on disk. Only the row with that exact key can+ * say no: a cache-only (offline) listing keys cached files by what tells them apart ("ctc/F16" for+ * "v3-ctc/F16"), so a key it leaves out may still be cached; the backend matches it on load. */+export function sttListedQuantDownloaded(+ listing: { variants: readonly { quant: string; downloaded?: boolean }[] },+ pinned: string,+): boolean {+ return (+ listing.variants.find((variant) => variant.quant === pinned)?.downloaded !==+ false+ );+}+export function sttModelSize(model: SttModel): string {return STT_MODEL_SIZES[model as DefaultSttModel] ?? "";}diff --git a/studio/frontend/src/features/settings/stores/voice-settings-store.ts b/studio/frontend/src/features/settings/stores/voice-settings-store.tsindex 4a3921ce499..8e3a8bd3ce0 100644--- a/studio/frontend/src/features/settings/stores/voice-settings-store.ts+++ b/studio/frontend/src/features/settings/stores/voice-settings-store.ts@@ -103,23 +103,23 @@ export function isCuratedSttModel(model: SttModel): boolean {}export interface VoiceSettingsState {- /** Input device for dictation. "default" = system default microphone. */+ /** input device; "default" selects the system microphone. */micDeviceId: string;setMicDeviceId: (value: string) => void;- /**- * "browser": Web Speech API. "model": local transcription; the model decides- * the backend (whisper.cpp for curated GGML, Transformers for custom repos).- */+ /** "browser" uses Web Speech API; "model" chooses the local backend from the model. */dictationEngine: DictationEngine;setDictationEngine: (value: DictationEngine) => void;- /** STT model to use when dictationEngine is "model". */+ /** STT model used when dictationEngine is "model". */sttModel: SttModel;setSttModel: (value: SttModel) => void;- /** "cpu" holds the dictation model in system RAM instead of the GPU. Sent- * with every load and transcribe, so a change applies on the next load. */+ /** quant for a package folder `sttModel`; "" uses its resident or default quant. */+ sttGgufVariant: string;+ setSttGgufVariant: (value: string) => void;++ /** "cpu" keeps the model in system RAM; loads and transcriptions apply the current value. */sttDevice: SttDevice;setSttDevice: (value: SttDevice) => void;@@ -128,11 +128,11 @@ export interface VoiceSettingsState {sttProviderModel: string;setSttProviderModel: (value: string) => void;- /** bcp 47 tag for speech recognition, or "auto" for engine-specific detection. */+ /** BCP 47 tag, or "auto" for engine-specific language detection. */dictationLanguage: string;setDictationLanguage: (value: string) => void;- /** Exact spellings applied to matching transcript words and phrases. */+ /** exact spellings applied to matching transcript words and phrases. */dictionary: string[];addDictionaryEntry: (value: string) => void;updateDictionaryEntry: (index: number, value: string) => void;@@ -234,17 +234,22 @@ export const useVoiceSettingsStore = create<VoiceSettingsState>()(sttModel: DEFAULT_STT_MODEL,setSttModel: (value) =>set((state) => {- const sttModel = normalizeSttModel(value);- return {- sttModel: isSttModelLanguageCompatible(- sttModel,- state.dictationLanguage,- )- ? sttModel- : DEFAULT_STT_MODEL,- };+ const normalized = normalizeSttModel(value);+ const sttModel = isSttModelLanguageCompatible(+ normalized,+ state.dictationLanguage,+ )+ ? normalized+ : DEFAULT_STT_MODEL;+ // a quant belongs to the model it was selected for.+ return sttModel === state.sttModel+ ? { sttModel }+ : { sttModel, sttGgufVariant: "" };}),+ sttGgufVariant: "",+ setSttGgufVariant: (sttGgufVariant) => set({ sttGgufVariant }),+sttDevice: DEFAULT_STT_DEVICE,setSttDevice: (value) => set({ sttDevice: normalizeSttDevice(value) }),@@ -255,15 +260,15 @@ export const useVoiceSettingsStore = create<VoiceSettingsState>()(dictationLanguage: "auto",setDictationLanguage: (dictationLanguage) =>- set((state) => ({- dictationLanguage,- sttModel: isSttModelLanguageCompatible(- state.sttModel,- dictationLanguage,- )- ? state.sttModel- : DEFAULT_STT_MODEL,- })),+ set((state) =>+ isSttModelLanguageCompatible(state.sttModel, dictationLanguage)+ ? { dictationLanguage }+ : {+ dictationLanguage,+ sttModel: DEFAULT_STT_MODEL,+ sttGgufVariant: "",+ },+ ),dictionary: [],addDictionaryEntry: (value) =>@@ -388,6 +393,10 @@ export const useVoiceSettingsStore = create<VoiceSettingsState>()(micDeviceId: asString(saved?.micDeviceId, "default"),dictationEngine,sttModel,+ sttGgufVariant:+ sttModel === savedSttModel+ ? asString(saved?.sttGgufVariant, "")+ : "",sttDevice: normalizeSttDevice(saved?.sttDevice),sttProviderId: asString(saved?.sttProviderId, ""),sttProviderModel: asString(saved?.sttProviderModel, ""),diff --git a/studio/frontend/src/features/settings/tabs/voice-tab.tsx b/studio/frontend/src/features/settings/tabs/voice-tab.tsxindex 0a1a617baa7..8375c9ad50b 100644--- a/studio/frontend/src/features/settings/tabs/voice-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/voice-tab.tsx@@ -44,7 +44,10 @@ import {validateSttModel,} from "@/features/chat";import {+ type GgufVariantsResponse,+ ggufVariantDisplayLabel,hfApiToken,+ invalidateGgufVariantsCache,listGgufVariants,useHfTokenStore,useHubModelSearch,@@ -87,6 +90,9 @@ import {isSttModelLanguageCompatible,sttModelName,sttModelSize,+ sttListedQuantDownloaded,+ sttModelVariant,+ sttShownVariant,type TtsEngine,useVoiceSettingsStore,} from "../stores/voice-settings-store";@@ -478,6 +484,10 @@ export function VoiceTab() {const setDictationEngine = useVoiceSettingsStore((s) => s.setDictationEngine);const sttModel = useVoiceSettingsStore((s) => s.sttModel);const setSttModel = useVoiceSettingsStore((s) => s.setSttModel);+ const sttGgufVariant = useVoiceSettingsStore((s) => s.sttGgufVariant);+ const setSttGgufVariant = useVoiceSettingsStore((s) => s.setSttGgufVariant);+ // The quant a pinned package folder row runs; null leaves the row's resident or default one.+ const sttVariant = sttModelVariant(sttModel, sttGgufVariant);// Named apart from the `sttDevice` state below, which the sidecar reports back.const sttDevicePreference = useVoiceSettingsStore((s) => s.sttDevice);const setSttDevicePreference = useVoiceSettingsStore((s) => s.setSttDevice);@@ -629,31 +639,85 @@ export function VoiceTab() {// so one throttled timer or bursty poll set the displayed speed outright.// Model whose download this tab watched; completion auto-loads it.const watchedDownloadRef = useRef<string | null>(null);+ // The quant this tab started downloading; an adopted transfer's quant is unknown.+ const startedDownloadRef = useRef<{+ model: string;+ variant: string | null;+ } | null>(null);+ // Quant resident for the selected row, so an unpinned Select shows what dictation would run.+ const [sttLoadedVariant, setSttLoadedVariant] = useState<string | null>(null);+ // The selected package folder's quants, from the same cached listing the Transcribe picker reads.+ const [sttVariantListing, setSttVariantListing] = useState<{+ model: string;+ listing: GgufVariantsResponse;+ } | null>(null);+ const [sttListingNonce, setSttListingNonce] = useState(0);// Selecting a model (or finishing its download) loads it without a Load// click. A model that is not downloaded fails quietly and stays on demand.- const autoLoadSttModel = useCallback(async (model: string) => {- setSttPhase("loading");- try {- await loadSttModel(model);- } catch {- // Not downloaded (or the engine is busy): the status poll resets the phase- // and the user still sees the Download button.- } finally {- setStatusNonce((nonce) => nonce + 1);- }- }, []);+ const autoLoadSttModel = useCallback(+ async (model: string, variant: string | null = null) => {+ setSttPhase("loading");+ try {+ await loadSttModel(model, undefined, undefined, undefined, variant);+ } catch {+ // Not downloaded (or the engine is busy): the status poll resets the phase+ // and the user still sees the Download button.+ } finally {+ setStatusNonce((nonce) => nonce + 1);+ }+ },+ [],+ );const sttRepoId = getSttModelRepo(sttModel);const hfToken = useHfTokenStore((state) => state.token);+ // biome-ignore lint/correctness/useExhaustiveDependencies: sttListingNonce is the refetch trigger once a quant lands.+ useEffect(() => {+ if (!isLocalEngine || !isAudioCppFolderId(sttModel)) return;+ let cancelled = false;+ listGgufVariants(sttModel, hfApiToken(hfToken))+ .then((listing) => {+ if (!cancelled) setSttVariantListing({ model: sttModel, listing });+ })+ .catch(() => {});+ return () => {+ cancelled = true;+ };+ }, [isLocalEngine, sttModel, hfToken, sttListingNonce]);+ const sttVariants =+ sttVariantListing?.model === sttModel+ ? sttVariantListing.listing.variants+ : [];+ const shownSttVariant = sttShownVariant(+ sttVariant,+ sttLoadedVariant,+ sttVariantListing?.model === sttModel ? sttVariantListing.listing : null,+ );+ const shownSttLabel = ggufVariantDisplayLabel(+ sttVariants.find((variant) => variant.quant === shownSttVariant) ?? {+ quant: shownSttVariant ?? "",+ },+ );const [sttDownloadStarting, setSttDownloadStarting] = useState(false);const [sttDownloadAvailability, setSttDownloadAvailability] = useState<{repoId: string;state: SttDownloadAvailability;}>({ repoId: "", state: "checking" });- const effectiveSttDownloadAvailability =+ const rowSttDownloadAvailability =sttDownloadAvailability.repoId === sttRepoId? sttDownloadAvailability.state: "checking";+ // Status knows rows, not quants: a pinned quant of a row with another one cached is missing, or+ // failed when its download did, as a row's would.+ const effectiveSttDownloadAvailability =+ rowSttDownloadAvailability === "downloaded" &&+ sttVariant &&+ sttVariantListing?.model === sttModel &&+ !sttListedQuantDownloaded(sttVariantListing.listing, sttVariant)+ ? sttDownload?.error+ ? "error"+ : "missing"+ : rowSttDownloadAvailability;useEffect(() => {if (!isLocalEngine || !modelSttSupported) {return;@@ -685,6 +749,14 @@ export function VoiceTab() {setSttPhase("unavailable");return;}+ const rowLoaded = engineStatus.loaded_model === sttModel;+ setSttLoadedVariant(+ rowLoaded ? (engineStatus.loaded_variant ?? null) : null,+ );+ // A pinned quant is ready only when that quant is the resident one.+ const loaded =+ rowLoaded &&+ (!sttVariant || engineStatus.loaded_variant === sttVariant);const download = engineStatus.download;setSttDownload(download);setSttDownloadAvailability({@@ -709,13 +781,26 @@ export function VoiceTab() {} else {const finished = watchedDownloadRef.current;watchedDownloadRef.current = null;+ const started = startedDownloadRef.current;+ startedDownloadRef.current = null;+ // Only the quant that landed may load: a quant picked meanwhile is not on disk.+ const landedPinned =+ started?.model === finished+ ? started.variant === sttVariant+ : sttVariant === null;+ if (finished === sttModel && isAudioCppFolderId(sttModel)) {+ // The cached listing still has this quant as not downloaded.+ invalidateGgufVariantsCache(sttModel);+ setSttListingNonce((nonce) => nonce + 1);+ }if (finished === sttModel &&engineStatus.downloaded_models.includes(sttModel) &&- engineStatus.loaded_model !== sttModel+ !loaded &&+ landedPinned) {// The download this tab watched just finished; load the model.- void autoLoadSttModel(sttModel);+ void autoLoadSttModel(sttModel, sttVariant);return;}}@@ -726,7 +811,7 @@ export function VoiceTab() {}, 600);return;}- if (engineStatus.loaded_model === sttModel && !engineStatus.loading) {+ if (loaded && !engineStatus.loading) {setSttDevice(engineStatus.device);setSttPhase("ready");window.setTimeout(@@ -754,6 +839,7 @@ export function VoiceTab() {}, [isLocalEngine,sttModel,+ sttVariant,sttRepoId,modelSttSupported,statusNonce,@@ -824,8 +910,14 @@ export function VoiceTab() {const beginSttDownload = async () => {setSttDownloadStarting(true);try {- await startSttDownload(sttModel, hfApiToken(hfToken));- trackSttDownload(sttModel);+ await startSttDownload(+ sttModel,+ hfApiToken(hfToken),+ undefined,+ sttVariant,+ );+ trackSttDownload(sttModel, { ggufVariant: sttVariant });+ startedDownloadRef.current = { model: sttModel, variant: sttVariant };// The status effect only re-polls while it can see a download. Its last read was before this// one existed, and the on-demand branch schedules nothing, so without a nudge the tab shows// Download for the whole transfer.@@ -842,7 +934,7 @@ export function VoiceTab() {const warmSttModel = async () => {setSttPhase("loading");try {- await loadSttModel(sttModel);+ await loadSttModel(sttModel, undefined, undefined, undefined, sttVariant);setStatusNonce((nonce) => nonce + 1);} catch (error) {setSttPhase("error");@@ -1126,7 +1218,11 @@ export function VoiceTab() {modelSttSupported ? (<SettingsRowlabel={t("settings.voice.dictation.sttModelLabel")}- description={t("settings.voice.dictation.sttModelDescription")}+ description={+ sttVariants.length > 1+ ? t("settings.voice.dictation.sttQuantDescription")+ : t("settings.voice.dictation.sttModelDescription")+ }// Progress lives in the shared downloads panel; a second bar here// said the same thing twice.below={@@ -1224,7 +1320,7 @@ export function VoiceTab() {</div>}>- <div className="w-56">+ <div className="flex w-56 flex-col gap-1.5"><SttModelPickervalue={sttModel}language={dictationLanguage}@@ -1237,6 +1333,61 @@ export function VoiceTab() {setSttModel(next);}}/>+ {/* A saved key names its own quant, so only package folder rows offer one. */}+ {sttVariants.length > 1 ? (+ // Bound to the pin, not the shown quant: picking the quant that runs now+ // must still save it, or an idle unload drops back to another one.+ <Select+ value={sttVariant ?? ""}+ onValueChange={(next) => {+ setSttGgufVariant(next);+ if (next === shownSttVariant) return;+ void unloadSttModel().catch(() => {});+ void autoLoadSttModel(sttModel, next);+ }}+ >+ <SelectTrigger+ data-testid="stt-quant-trigger"+ aria-label={t("settings.voice.dictation.sttQuantLabel")}+ className="w-full font-mono text-xs"+ size="sm"+ >+ {/* Unpinned, the value is "" and Radix renders the placeholder. */}+ <SelectValue placeholder={shownSttLabel}>+ {shownSttLabel}+ </SelectValue>+ </SelectTrigger>+ <SelectContent align="end">+ {sttVariants.map((variant) => (+ <SelectItem+ key={variant.quant}+ value={variant.quant}+ // Size flush right, as in the Agents quant list.+ className="[&>span:last-child]:w-full [&>span:last-child]:justify-between"+ >+ <span className="flex items-center gap-1.5 font-mono text-xs whitespace-nowrap">+ {/* The slot stays when empty, so the labels share a column. */}+ {variant.downloaded ? (+ <span+ role="img"+ aria-label={t("picker.onDevice")}+ className="size-[calc(5px*var(--ui-space-scale,1))] shrink-0 rounded-full bg-status-success"+ />+ ) : (+ <span className="size-[calc(5px*var(--ui-space-scale,1))] shrink-0" />+ )}+ {ggufVariantDisplayLabel(variant)}+ </span>+ <span className="text-ui-10 tabular-nums whitespace-nowrap text-muted-foreground">+ {audioCppSizeLabel(+ variant.download_size_bytes ?? variant.size_bytes,+ )}+ </span>+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ ) : null}</div></SettingsRow>) : (diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 415a22db20c..3e06ef6877d 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -1290,6 +1290,9 @@ export const ar = {customModelDescription: "اسم النموذج المرسل إلى /v1/audio/transcriptions.",sttModelLabel: "نموذج التعرّف على الكلام",sttModelDescription: "اختر نموذج STT أو ابحث عنه لتشغيله محليًا.",+ sttQuantLabel: "التكميم",+ sttQuantDescription:+ "اختر نموذج STT أو ابحث عنه لتشغيله محليًا، ثم اختر التكميم.",sttDeviceLabel: "التحميل إلى",sttDeviceAuto: "وحدة معالجة الرسومات عند توفرها",sttDeviceCpu: "ذاكرة المعالج",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 5700f95beb2..17fc34b41ba 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -1296,6 +1296,9 @@ export const de = {sttModelLabel: "Spracherkennungsmodell",sttModelDescription:"Wählen oder suchen Sie ein STT-Modell für die lokale Ausführung.",+ sttQuantLabel: "Quantisierung",+ sttQuantDescription:+ "Wählen oder suchen Sie ein STT-Modell für die lokale Ausführung, dann seine Quantisierung.",sttDeviceLabel: "Laden in",sttDeviceAuto: "GPU, wenn verfügbar",sttDeviceCpu: "CPU-RAM",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex ef364165212..e00753f17a0 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -1337,6 +1337,9 @@ export const en = {customModelDescription: "Model name sent to /v1/audio/transcriptions.",sttModelLabel: "Speech recognition model",sttModelDescription: "Choose or search a STT model to run locally.",+ sttQuantLabel: "Quantization",+ sttQuantDescription:+ "Choose or search a STT model to run locally, then its quantization.",sttDeviceLabel: "Load into",sttDeviceAuto: "GPU when available",sttDeviceCpu: "CPU RAM",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 116fd361031..956accd21a4 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -1295,6 +1295,9 @@ export const es = {sttModelLabel: "Modelo de reconocimiento de voz",sttModelDescription:"Elige o busca un modelo STT para ejecutarlo en local.",+ sttQuantLabel: "Cuantización",+ sttQuantDescription:+ "Elige o busca un modelo STT para ejecutarlo en local y luego su cuantización.",sttDeviceLabel: "Cargar en",sttDeviceAuto: "GPU cuando esté disponible",sttDeviceCpu: "RAM de la CPU",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex 7e7792b894f..4fcd556c2c1 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -1296,6 +1296,9 @@ export const fr = {sttModelLabel: "Modèle de reconnaissance vocale",sttModelDescription:"Choisissez ou recherchez un modèle STT à exécuter en local.",+ sttQuantLabel: "Quantification",+ sttQuantDescription:+ "Choisissez ou recherchez un modèle STT à exécuter en local, puis sa quantification.",sttDeviceLabel: "Charger dans",sttDeviceAuto: "GPU si disponible",sttDeviceCpu: "RAM du CPU",diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.tsindex a4b40b0bd2b..96c979d6f58 100644--- a/studio/frontend/src/i18n/locales/he.ts+++ b/studio/frontend/src/i18n/locales/he.ts@@ -1389,6 +1389,9 @@ export const he = {customModelDescription: "שם המודל שנשלח אל /v1/audio/transcriptions.",sttModelLabel: "מודל זיהוי דיבור",sttModelDescription: "בחר או חפש מודל STT להרצה מקומית.",+ sttQuantLabel: "קוונטיזציה",+ sttQuantDescription:+ "בחר או חפש מודל STT להרצה מקומית, ואז את הקוונטיזציה שלו.",sttDeviceLabel: "טען אל",sttDeviceAuto: "GPU כאשר זמין",sttDeviceCpu: "זיכרון RAM של ה-CPU",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 2492b61532e..9382a0be379 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -1294,6 +1294,9 @@ export const hi = {"/v1/audio/transcriptions को भेजा जाने वाला मॉडल नाम।",sttModelLabel: "स्पीच रिकग्निशन मॉडल",sttModelDescription: "लोकली चलाने के लिए STT मॉडल चुनें या खोजें।",+ sttQuantLabel: "क्वांटाइज़ेशन",+ sttQuantDescription:+ "लोकली चलाने के लिए STT मॉडल चुनें या खोजें, फिर उसका क्वांटाइज़ेशन चुनें।",sttDeviceLabel: "इसमें लोड करें",sttDeviceAuto: "उपलब्ध होने पर GPU",sttDeviceCpu: "CPU RAM",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex 9f07f487c99..f5ab5d88979 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -1253,6 +1253,9 @@ export const it = {sttModelLabel: "Modello di riconoscimento vocale",sttModelDescription:"Scegli o cerca un modello STT da eseguire in locale.",+ sttQuantLabel: "Quantizzazione",+ sttQuantDescription:+ "Scegli o cerca un modello STT da eseguire in locale, poi la sua quantizzazione.",sttDeviceLabel: "Carica in",sttDeviceAuto: "GPU quando disponibile",sttDeviceCpu: "RAM della CPU",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex be53e905c01..afad5ee5ddc 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -1294,6 +1294,9 @@ export const ja = {sttModelLabel: "音声認識モデル",sttModelDescription:"ローカルで実行する STT モデルを選択または検索します。",+ sttQuantLabel: "量子化",+ sttQuantDescription:+ "ローカルで実行する STT モデルを選択または検索し、量子化を選びます。",sttDeviceLabel: "読み込み先",sttDeviceAuto: "GPU(利用できる場合)",sttDeviceCpu: "CPU メモリ",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex c191187f654..38debcbfbab 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -1291,6 +1291,9 @@ export const ko = {"/v1/audio/transcriptions에 전송할 모델 이름입니다.",sttModelLabel: "음성 인식 모델",sttModelDescription: "로컬에서 실행할 STT 모델을 선택하거나 검색하세요.",+ sttQuantLabel: "양자화",+ sttQuantDescription:+ "로컬에서 실행할 STT 모델을 선택하거나 검색한 다음 양자화를 고르세요.",sttDeviceLabel: "로드 위치",sttDeviceAuto: "GPU(사용 가능할 때)",sttDeviceCpu: "CPU RAM",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 5a93e96e91e..4e0196b05fc 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -1294,6 +1294,9 @@ export const ptBR = {sttModelLabel: "Modelo de reconhecimento de fala",sttModelDescription:"Escolha ou busque um modelo STT para executar localmente.",+ sttQuantLabel: "Quantização",+ sttQuantDescription:+ "Escolha ou busque um modelo STT para executar localmente e depois sua quantização.",sttDeviceLabel: "Carregar em",sttDeviceAuto: "GPU quando disponível",sttDeviceCpu: "RAM da CPU",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex ff799ff289b..a5c1fce8c58 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -1293,6 +1293,9 @@ export const ru = {sttModelLabel: "Модель распознавания речи",sttModelDescription:"Выберите или найдите модель STT для локального запуска.",+ sttQuantLabel: "Квантизация",+ sttQuantDescription:+ "Выберите или найдите модель STT для локального запуска, затем её квантизацию.",sttDeviceLabel: "Загружать в",sttDeviceAuto: "GPU, если доступен",sttDeviceCpu: "ОЗУ процессора",diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.tsindex 0194ae1e483..66ba105da1a 100644--- a/studio/frontend/src/i18n/locales/sv.ts+++ b/studio/frontend/src/i18n/locales/sv.ts@@ -1427,6 +1427,9 @@ export const sv = {sttModelLabel: "Taligenkänningsmodell",sttModelDescription:"Välj eller sök efter en STT-modell som ska köras lokalt.",+ sttQuantLabel: "Kvantisering",+ sttQuantDescription:+ "Välj eller sök efter en STT-modell som ska köras lokalt och sedan dess kvantisering.",sttDeviceLabel: "Läs in i",sttDeviceAuto: "GPU när tillgänglig",sttDeviceCpu: "CPU-RAM",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex e35a014a4d4..933c9057b50 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -1288,6 +1288,9 @@ export const zhCN = {"发送到 /v1/audio/transcriptions 的模型名称。",sttModelLabel: "语音识别模型",sttModelDescription: "选择或搜索要在本地运行的 STT 模型。",+ sttQuantLabel: "量化",+ sttQuantDescription:+ "选择或搜索要在本地运行的 STT 模型,再选择其量化。",sttDeviceLabel: "加载到",sttDeviceAuto: "有 GPU 时使用 GPU",sttDeviceCpu: "CPU 内存",diff --git a/studio/frontend/tests/audio-cpp-catalog.test.ts b/studio/frontend/tests/audio-cpp-catalog.test.tsindex 525eb4f3407..e78760ed4a2 100644--- a/studio/frontend/tests/audio-cpp-catalog.test.ts+++ b/studio/frontend/tests/audio-cpp-catalog.test.ts@@ -73,6 +73,10 @@ import {STT_PICKER_MODELS,sttModelName,sttModelSize,+ sttModelVariant,+ sttListedQuantDownloaded,+ sttShownVariant,+ withSttVariant,} from "../src/features/settings/stores/stt-model-catalog.ts";import {@@ -523,9 +527,132 @@ test("an Audio-page ASR pick sends its quant; other engines and saved keys sendpage.match(/controller\.signal,\s*undefined,\s*ggufVariant,/g)?.length,2,);- // Settings > Voice passes a saved key and no variant.+ // Settings > Voice sends its saved quant only for package folders.const voiceTab = readSrc("features/settings/tabs/voice-tab.tsx");- assert.match(voiceTab, /await startSttDownload\(sttModel, hfApiToken\(hfToken\)\);/);+ assert.match(+ voiceTab,+ /await startSttDownload\(\s*sttModel,\s*hfApiToken\(hfToken\),\s*undefined,\s*sttVariant,\s*\);/,+ );+ assert.match(voiceTab, /const sttVariant = sttModelVariant\(sttModel, sttGgufVariant\);/);+});++const GIGAAM = `${AUDIO_CPP_REPO}/GigaAM-ASR-GGUF`;++test("only a package folder row runs a saved quant; saved keys and other engines ignore it", () => {+ assert.equal(sttModelVariant(GIGAAM, "v3-ctc/F16"), "v3-ctc/F16");+ assert.equal(withSttVariant(GIGAAM, "v3-ctc/F16"), `${GIGAAM}:v3-ctc/F16`);+ // an empty pin keeps the resident quant, or the default when none is resident.+ assert.equal(sttModelVariant(GIGAAM, ""), null);+ assert.equal(withSttVariant(GIGAAM, ""), GIGAAM);+ for (const model of ["audiocpp-moonshine-small", "qwen3-asr-0.6b", "small", "openai/whisper-small"]) {+ assert.equal(sttModelVariant(model, "Q8_0"), null, model);+ assert.equal(withSttVariant(model, "Q8_0"), model, model);+ }+});++test("the saved quant is cleared with its model and rehydrated only beside it", () => {+ const store = readSrc("features/settings/stores/voice-settings-store.ts");+ assert.match(+ store,+ /return sttModel === state\.sttModel\s*\?\s*\{ sttModel \}\s*:\s*\{ sttModel, sttGgufVariant: "" \};/,+ );+ assert.match(store, /sttModel: DEFAULT_STT_MODEL,\s*sttGgufVariant: "",/);+ assert.match(+ store,+ /sttGgufVariant:\s*sttModel === savedSttModel\s*\?\s*asString\(saved\?\.sttGgufVariant, ""\)\s*:\s*"",/,+ );+});++test("every Settings dictation path carries the saved quant", () => {+ const adapter = readSrc("features/chat/adapters/studio-model-dictation-adapter.ts");+ // a raw transcription folds the quant into the id so a cold sidecar does not load the default.+ assert.match(+ adapter,+ /model:\s*engine === "audiocpp" && variant \? withSttVariant\(model, variant\) : model,/,+ );+ assert.match(adapter, /sttModelVariant\(model, settings\.sttGgufVariant\)/);+ // the session pins the quant for preload and every segment.+ assert.match(adapter, /const sessionVariant = usesExternalEndpoint\s*\?\s*null\s*:\s*sttModelVariant\(sessionModel, settings\.sttGgufVariant\);/);+ assert.match(adapter, /ggufVariant: sessionVariant,/);+ assert.match(adapter, /sessionEngine,\s*undefined,\s*undefined,\s*sessionVariant,/);++ const voiceTab = readSrc("features/settings/tabs/voice-tab.tsx");+ assert.match(voiceTab, /await loadSttModel\(sttModel, undefined, undefined, undefined, sttVariant\);/);+ assert.match(voiceTab, /void autoLoadSttModel\(sttModel, sttVariant\);/);+ // ready requires the pinned quant to be resident, not merely its row.+ assert.match(voiceTab, /\(!sttVariant \|\| engineStatus\.loaded_variant === sttVariant\)/);+ // status is row-level; the listing shows whether the pinned quant is cached.+ assert.match(+ voiceTab,+ /!sttListedQuantDownloaded\(sttVariantListing\.listing, sttVariant\)\s*\?\s*sttDownload\?\.error\s*\?\s*"error"\s*:\s*"missing"/,+ );+ // binding Select to the pin preserves an active quant selection.+ assert.match(voiceTab, /value=\{sttVariant \?\? ""\}/);+ assert.match(voiceTab, /setSttGgufVariant\(next\);\s*if \(next === shownSttVariant\) return;/);+ assert.match(voiceTab, /<SelectValue placeholder=\{shownSttLabel\}>/);++ // the prompt fetches the requester's pin, not the current Voice setting.+ const prompt = readSrc("features/settings/components/stt-download-prompt.tsx");+ assert.match(prompt, /hfApiToken\(hfToken\),\s*undefined,\s*request\.ggufVariant,/);+ assert.match(prompt, /const variant = pending\?\.ggufVariant \?\? null;/);+ assert.doesNotMatch(prompt, /sttGgufVariant/);+ assert.match(prompt, /candidate\.quant === \(variant \?\? listing\.default_variant\)/);+ assert.match(adapter, /requestSttDownload\(sessionModel, \{ ggufVariant: sessionVariant \}\)/);+ const offer = readSrc("features/chat/adapters/studio-dictation-adapter.tsx");+ assert.match(offer, /const ggufVariant = sttModelVariant\(sttModel, sttGgufVariant\);/);+ assert.match(offer, /requestSttDownload\(sttModel, \{ selectLocalEngine: true, ggufVariant \}\)/);++ const mirror = readSrc("features/settings/lib/stt-download-mirror.ts");+ // a stopped second-quant download must not look complete because its row is already listed.+ const cancelledAt = mirror.indexOf("download?.cancelled && (download.cancelled_model ?? model) === model");+ const erroredAt = mirror.indexOf("if (download?.error)");+ const downloadedAt = mirror.indexOf("if (engineStatus?.downloaded_models.includes(model))");+ assert.ok(cancelledAt > 0 && cancelledAt < erroredAt && erroredAt < downloadedAt);+ // do not warm a new pin after another quant lands; adopted downloads warm only unpinned rows.+ assert.match(+ mirror,+ /\(tracked === undefined \? variant === null : tracked === variant\)/,+ );+ assert.match(voiceTab, /trackSttDownload\(sttModel, \{ ggufVariant: sttVariant \}\)/);+ // The tab's own watcher loads a landed download only when it is still the pinned quant.+ assert.match(voiceTab, /startedDownloadRef\.current = \{ model: sttModel, variant: sttVariant \};/);+ assert.match(+ voiceTab,+ /started\?\.model === finished\s*\?\s*started\.variant === sttVariant\s*:\s*sttVariant === null;/,+ );+ assert.match(voiceTab, /!loaded &&\s*landedPinned\s*\)/);+ assert.match(prompt, /trackSttDownload\(request\.model, \{\s*ggufVariant: request\.ggufVariant \?\? null,\s*\}\)/);+ assert.match(mirror, /sttModelVariant\(model, sttGgufVariant\)/);+ assert.match(mirror, /outcome === "complete" && isAudioCppFolderId\(model\)[\s\S]*invalidateGgufVariantsCache\(model\)/);++ const upload = readSrc("features/chat/hooks/use-chat-audio-upload.ts");+ assert.match(upload, /ggufVariant: sttModelVariant\(model\.trim\(\), ggufVariant\),/);+ assert.match(upload, /ggufVariant: source\.ggufVariant,/);+ for (const holder of ["target", "source", "failed\\.snapshot"]) {+ assert.match(upload, new RegExp(`requestSttDownload\\([^)]*\\{\\s*ggufVariant: ${holder}\\.ggufVariant,`));+ }+ // status lists a row after any quant is cached; a pin needs its own listing row.+ assert.match(adapter, /return !listing \|\| sttListedQuantDownloaded\(listing, ggufVariant\);/);+ // upload readiness and the no-service fallback require the pinned quant on disk.+ assert.match(upload, /sttQuantDownloaded\(\s*targetModel,\s*target\.ggufVariant,\s*signal,\s*\)/);+ assert.match(+ upload,+ /engineStatus\.downloaded_models\.includes\(targetModel\) &&\s*quantDownloaded\s*\?\s*"ready"/,+ );+ assert.match(+ offer,+ /engine\?\.downloaded_models\.includes\(sttModel\) &&\s*\(await sttQuantDownloaded\(sttModel, ggufVariant\)\)/,+ );++ const reference = readSrc("features/audio/hooks/use-reference-transcribe.ts");+ assert.match(reference, /withSttVariant\(model, voice\.sttGgufVariant\)/);+});++test("the quant Select appears for package folders with more than one quant", () => {+ const voiceTab = readSrc("features/settings/tabs/voice-tab.tsx");+ assert.match(voiceTab, /\{sttVariants\.length > 1 \? \([\s\S]{0,200}?<Select\s/);+ assert.match(voiceTab, /if \(!isLocalEngine \|\| !isAudioCppFolderId\(sttModel\)\) return;/);+ assert.match(voiceTab, /aria-label=\{t\("settings\.voice\.dictation\.sttQuantLabel"\)\}/);});test("sttEngineFor sends saved keys, folders and GGUF repos to the audiocpp engine", () => {@@ -761,3 +888,57 @@ test("the picked STT quant is remembered with the repo across a restart", () =>assert.match(page, /lastSttRepo && lastSttVariant \? \[\[lastSttRepo\.toLowerCase\(\), lastSttVariant\]\]/);assert.match(page, /setLastSttVariant\(sttGgufVariants\.current\.get\(repo\.toLowerCase\(\)\) \?\? ""\)/);});++test("the quant Select shows the quant a dictation would actually run", () => {+ const listing = {+ default_variant: "multilingual-ctc/F16",+ variants: [+ { quant: "multilingual-ctc/F16", downloaded: false },+ { quant: "v3-ctc/F16", downloaded: true },+ { quant: "v3-rnnt/F16", downloaded: true },+ ],+ };+ // a pin overrides the resident quant.+ assert.equal(sttShownVariant("v3-rnnt/F16", "v3-ctc/F16", listing), "v3-rnnt/F16");+ // without a pin, the resident quant runs.+ assert.equal(sttShownVariant(null, "v3-rnnt/F16", listing), "v3-rnnt/F16");+ // without a resident quant, an offline bare load uses the first cached quant.+ assert.equal(sttShownVariant(null, null, listing), "v3-ctc/F16");+ // without a cache, use the default.+ const cold = { ...listing, variants: listing.variants.map((v) => ({ ...v, downloaded: false })) };+ assert.equal(sttShownVariant(null, null, cold), "multilingual-ctc/F16");+ // a cache-only load reports a loose key that maps to its sole cached quant.+ const moonshine = {+ default_variant: "tiny/Q8_0",+ variants: [+ { quant: "tiny/Q8_0", downloaded: false },+ { quant: "small/Q8_0", downloaded: true },+ ],+ };+ assert.equal(sttShownVariant(null, "Q8_0", moonshine), "small/Q8_0");+ // without a listing, use the resident quant.+ assert.equal(sttShownVariant(null, "Q8_0", null), "Q8_0");+ const voiceTab = readSrc("features/settings/tabs/voice-tab.tsx");+ assert.match(voiceTab, /const shownSttVariant = sttShownVariant\(\s*sttVariant,\s*sttLoadedVariant,/);+});++test("only the pinned quant's own listing row can say it is not on disk", () => {+ const online = {+ variants: [+ { quant: "multilingual-ctc/F16", downloaded: true },+ { quant: "v3-ctc/F16", downloaded: false },+ ],+ };+ assert.equal(sttListedQuantDownloaded(online, "multilingual-ctc/F16"), true);+ assert.equal(sttListedQuantDownloaded(online, "v3-ctc/F16"), false);+ // A cache-only listing keys cached files by what tells them apart, so a pinned key it leaves out+ // may still be cached (the backend matches it on load): defer instead of calling it missing.+ const offline = {+ variants: [+ { quant: "ctc/F16", downloaded: true },+ { quant: "rnnt/F16", downloaded: true },+ ],+ };+ assert.equal(sttListedQuantDownloaded(offline, "v3-ctc/F16"), true);+ assert.equal(sttListedQuantDownloaded({ variants: [] }, "small/Q8_0"), true);+});