mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 17:15:19 -07:00
fix(dictation): skip LLM readiness gate when auto_refine is off (#753)
When the user disables auto_refine (LLM polish) in Settings, the Qwen refinement model is no longer required for dictation to arm. Previously, canRecord checked llmReady unconditionally, so useChordSync called disable_hotkey whenever Qwen was not downloaded -- even if the user never intended to use refinement. Changes: - useDictationReadiness: gate llmReady behind autoRefine in canRecord, missing, and the polling predicates so hotkeys arm with just Whisper STT when refinement is off. - DictationReadinessChecklist: hide the LLM row when autoRefine is false -- the checklist now shows only Whisper STT. Closes #753
This commit is contained in:
committed by
capy-ai-staging[bot]
parent
4a03cd7e77
commit
0e1e9922a8
@@ -222,7 +222,7 @@ export function DictationReadinessChecklist({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{readiness.llm && (
|
{readiness.autoRefine && readiness.llm && (
|
||||||
<ChecklistRow
|
<ChecklistRow
|
||||||
icon={<Cpu className="h-3.5 w-3.5" />}
|
icon={<Cpu className="h-3.5 w-3.5" />}
|
||||||
title={t('captures.readiness.llm.label', { name: readiness.llm.display_name })}
|
title={t('captures.readiness.llm.label', { name: readiness.llm.display_name })}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useAccessibilityPermission } from '@/components/AccessibilityGate/Acces
|
|||||||
import { useInputMonitoringPermission } from '@/components/InputMonitoringGate/InputMonitoringGate';
|
import { useInputMonitoringPermission } from '@/components/InputMonitoringGate/InputMonitoringGate';
|
||||||
import { apiClient } from '@/lib/api/client';
|
import { apiClient } from '@/lib/api/client';
|
||||||
import type { ModelReadiness } from '@/lib/api/types';
|
import type { ModelReadiness } from '@/lib/api/types';
|
||||||
|
import { useCaptureSettings } from '@/lib/hooks/useSettings';
|
||||||
import { usePlatform } from '@/platform/PlatformContext';
|
import { usePlatform } from '@/platform/PlatformContext';
|
||||||
|
|
||||||
const READINESS_POLL_INTERVAL_MS = 5_000;
|
const READINESS_POLL_INTERVAL_MS = 5_000;
|
||||||
@@ -17,6 +18,8 @@ export interface DictationReadiness {
|
|||||||
missing: ReadinessGate[];
|
missing: ReadinessGate[];
|
||||||
stt: ModelReadiness | undefined;
|
stt: ModelReadiness | undefined;
|
||||||
llm: ModelReadiness | undefined;
|
llm: ModelReadiness | undefined;
|
||||||
|
/** Whether the user has auto-refine (LLM polish) enabled. */
|
||||||
|
autoRefine: boolean;
|
||||||
inputMonitoring: boolean;
|
inputMonitoring: boolean;
|
||||||
accessibility: boolean;
|
accessibility: boolean;
|
||||||
refetch: () => void;
|
refetch: () => void;
|
||||||
@@ -46,6 +49,8 @@ export interface DictationReadiness {
|
|||||||
export function useDictationReadiness(): DictationReadiness {
|
export function useDictationReadiness(): DictationReadiness {
|
||||||
const platform = usePlatform();
|
const platform = usePlatform();
|
||||||
const isTauri = platform.metadata.isTauri;
|
const isTauri = platform.metadata.isTauri;
|
||||||
|
const { settings } = useCaptureSettings();
|
||||||
|
const autoRefine = settings?.auto_refine ?? true;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
needsPermission: inputMonNeeds,
|
needsPermission: inputMonNeeds,
|
||||||
@@ -61,17 +66,19 @@ export function useDictationReadiness(): DictationReadiness {
|
|||||||
const { data, isLoading, refetch } = useQuery({
|
const { data, isLoading, refetch } = useQuery({
|
||||||
queryKey: ['capture-readiness'],
|
queryKey: ['capture-readiness'],
|
||||||
queryFn: () => apiClient.getCaptureReadiness(),
|
queryFn: () => apiClient.getCaptureReadiness(),
|
||||||
// Poll only while a model is still missing/downloading. Once both are
|
// Poll only while a required model is still missing/downloading. Once
|
||||||
// green the endpoint's answer can't change until the user swaps models
|
// all required models are green the endpoint's answer can't change
|
||||||
// in settings, and that path invalidates the query explicitly from
|
// until the user swaps models in settings, and that path invalidates
|
||||||
// useSettings. refetchOnWindowFocus stays gated to the same condition.
|
// the query explicitly from useSettings. refetchOnWindowFocus stays
|
||||||
|
// gated to the same condition.
|
||||||
refetchInterval: (query) => {
|
refetchInterval: (query) => {
|
||||||
const d = query.state.data;
|
const d = query.state.data;
|
||||||
return d && d.stt.ready && d.llm.ready ? false : READINESS_POLL_INTERVAL_MS;
|
const allGreen = d && d.stt.ready && (!autoRefine || d.llm.ready);
|
||||||
|
return allGreen ? false : READINESS_POLL_INTERVAL_MS;
|
||||||
},
|
},
|
||||||
refetchOnWindowFocus: (query) => {
|
refetchOnWindowFocus: (query) => {
|
||||||
const d = query.state.data;
|
const d = query.state.data;
|
||||||
return !(d && d.stt.ready && d.llm.ready);
|
return !(d && d.stt.ready && (!autoRefine || d.llm.ready));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,10 +91,10 @@ export function useDictationReadiness(): DictationReadiness {
|
|||||||
|
|
||||||
const missing: ReadinessGate[] = [];
|
const missing: ReadinessGate[] = [];
|
||||||
if (!sttReady) missing.push('stt');
|
if (!sttReady) missing.push('stt');
|
||||||
if (!llmReady) missing.push('llm');
|
if (autoRefine && !llmReady) missing.push('llm');
|
||||||
if (!inputMonitoring) missing.push('input_monitoring');
|
if (!inputMonitoring) missing.push('input_monitoring');
|
||||||
if (!accessibility) missing.push('accessibility');
|
if (!accessibility) missing.push('accessibility');
|
||||||
const canRecord = sttReady && llmReady && inputMonitoring;
|
const canRecord = sttReady && (!autoRefine || llmReady) && inputMonitoring;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -96,6 +103,7 @@ export function useDictationReadiness(): DictationReadiness {
|
|||||||
missing,
|
missing,
|
||||||
stt: data?.stt,
|
stt: data?.stt,
|
||||||
llm: data?.llm,
|
llm: data?.llm,
|
||||||
|
autoRefine,
|
||||||
inputMonitoring,
|
inputMonitoring,
|
||||||
accessibility,
|
accessibility,
|
||||||
refetch: () => {
|
refetch: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user