The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(voice): remove always-on listening controls from voice panel
Steven Enamakel890f3b652a7f
diff --git a/app/src/components/settings/panels/VoicePanel.tsx b/app/src/components/settings/panels/VoicePanel.tsxindex 03c13a5514..e62ba9004b 100644--- a/app/src/components/settings/panels/VoicePanel.tsx+++ b/app/src/components/settings/panels/VoicePanel.tsx@@ -1,6 +1,6 @@import debug from 'debug';import { ArrowRight, AudioLines } from 'lucide-react';-import { useCallback, useEffect, useRef, useState } from 'react';+import { useCallback, useEffect, useState } from 'react';import { cn } from '../../../lib/cn';import { useT } from '../../../lib/i18n/I18nContext';@@ -14,13 +14,9 @@ import {type VoiceSettings,} from '../../../services/api/voiceSettingsApi';import {- openhumanGetVoiceServerSettings,- openhumanUpdateVoiceServerSettings,openhumanVoiceSetProviders,openhumanVoiceStatus,- syncNotchVisibility,type VoiceProvidersSnapshot,- type VoiceServerSettings,type VoiceStatus,} from '../../../utils/tauriCommands';import PanelPage from '../../layout/PanelPage';@@ -61,8 +57,6 @@ interface VoicePanelProps {const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {}) => {const { t } = useT();const { navigateBack, navigateToSettings } = useSettingsNavigation();- const [settings, setSettings] = useState<VoiceServerSettings | null>(null);- const [savedSettings, setSavedSettings] = useState<VoiceServerSettings | null>(null);const [voiceStatus, setVoiceStatus] = useState<VoiceStatus | null>(null);// Local provider selectors — initialised from voice_status, persisted via// openhumanVoiceSetProviders on change. Empty string until first load.@@ -71,7 +65,6 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {const [savedSttProvider, setSavedSttProvider] = useState<string>('');const [savedTtsProvider, setSavedTtsProvider] = useState<string>('');const [isSavingRouting, setIsSavingRouting] = useState(false);- const [isUpdatingAlwaysOn, setIsUpdatingAlwaysOn] = useState(false);const [ttsVoice, setTtsVoice] = useState<string>('');const [elevenlabsVoiceId, setElevenlabsVoiceId] = useState<string>('JBFqnCBsd6RMkjVDRZzb');const [isSavingProviders, setIsSavingProviders] = useState(false);@@ -85,8 +78,6 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {const [pendingKeySlug, setPendingKeySlug] = useState<string | null>(null);const [pendingKeyValue, setPendingKeyValue] = useState('');const [isSavingPendingKey, setIsSavingPendingKey] = useState(false);- const settingsRef = useRef<VoiceServerSettings | null>(null);- const savedSettingsRef = useRef<VoiceServerSettings | null>(null);const piperVoicePresets: ReadonlyArray<{ id: string; label: string }> = [{ id: 'en_US-lessac-medium', label: t('voice.providers.piperPreset.lessacMedium') },{ id: 'en_US-lessac-high', label: t('voice.providers.piperPreset.lessacHigh') },@@ -101,30 +92,9 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {},];- useEffect(() => {- settingsRef.current = settings;- }, [settings]);-- useEffect(() => {- savedSettingsRef.current = savedSettings;- }, [savedSettings]);-- const loadData = async (forceSettings = false) => {+ const loadData = async () => {try {- const [settingsResponse, voiceResponse] = await Promise.all([- openhumanGetVoiceServerSettings(),- openhumanVoiceStatus(),- ]);- const currentSettings = settingsRef.current;- const currentSavedSettings = savedSettingsRef.current;- if (- forceSettings ||- !currentSettings ||- JSON.stringify(currentSettings) === JSON.stringify(currentSavedSettings)- ) {- setSettings(settingsResponse.result);- }- setSavedSettings(settingsResponse.result);+ const voiceResponse = await openhumanVoiceStatus();setVoiceStatus(voiceResponse);// Seed the voice id from voice_status on first load only. There is no// STT counterpart: the model id belongs to whichever hosted engine is@@ -189,7 +159,7 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {};useEffect(() => {- void loadData(true);+ void loadData();}, []);const persistProviders = async (@@ -253,40 +223,6 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {}}, [sttProvider, ttsProvider, persistProviders, t]);- const toggleAlwaysOn = useCallback(- async (next: boolean) => {- if (!settings || isUpdatingAlwaysOn) return;-- const previous = settings.always_on_enabled;- setIsUpdatingAlwaysOn(true);- setError(null);- setNotice(null);- setSettings(current => (current ? { ...current, always_on_enabled: next } : current));-- try {- await openhumanUpdateVoiceServerSettings({ always_on_enabled: next });- setSavedSettings(current => (current ? { ...current, always_on_enabled: next } : current));- setNotice(t('voice.settingsSaved'));- } catch (err) {- setSettings(current => (current ? { ...current, always_on_enabled: previous } : current));- setError(err instanceof Error ? err.message : t('voice.failedToSaveSettings'));- setIsUpdatingAlwaysOn(false);- return;- }-- try {- // The notch is the always-on listening HUD. Persistence has already- // succeeded, so a window-sync error must not roll the setting back.- await syncNotchVisibility(next);- } catch (err) {- setError(err instanceof Error ? err.message : t('voice.failedToSaveSettings'));- } finally {- setIsUpdatingAlwaysOn(false);- }- },- [isUpdatingAlwaysOn, settings, t]- );-/*** Enable an external voice provider chip using the inline key form.* Called after the user enters an API key and clicks Save.@@ -412,38 +348,6 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {leading={embedded ? undefined : <SettingsBackButton onBack={navigateBack} />}scrollable={scrollable}><div className={embedded ? 'space-y-5' : 'p-4 space-y-5'}>- {/* Always-on listening: the one switch that changes how you talk to it. */}- <Card data-testid="voice-always-on-card">- <div className="flex items-center gap-3 p-4">- <span- className={cn(- 'flex h-10 w-10 shrink-0 items-center justify-center rounded-lg',- settings?.always_on_enabled- ? 'bg-primary-500 text-content-inverted'- : 'bg-surface-muted text-content-secondary'- )}>- <AudioLines className="h-5 w-5" aria-hidden />- </span>- <div className="min-w-0 flex-1">- <label htmlFor="voice-always-on" className="block text-sm font-semibold text-content">- {t('voice.debug.alwaysOn')}- </label>- <p className="mt-0.5 text-xs text-content-muted">{t('voice.debug.alwaysOnDesc')}</p>- </div>- <Switch- id="voice-always-on"- data-testid="voice-always-on-toggle"- checked={settings?.always_on_enabled ?? false}- disabled={!settings || isUpdatingAlwaysOn}- onCheckedChange={next => void toggleAlwaysOn(next)}- aria-label={t('voice.debug.alwaysOn')}- />- </div>- </Card>-- {/* Realtime voice is always on now — its controls live on the Human tab,- so the former flag-gated toggle here was removed. */}-{/* ─── Section 1: Voice Provider Chips ─────────────────────────── */}<VoicePanelProviderChipst={t}@@ -540,7 +444,7 @@ const VoicePanel = ({ embedded = false, scrollable = true }: VoicePanelProps = {{/* Status line */}<StatusLine- saving={isSavingProviders || isSavingRouting || isUpdatingAlwaysOn}+ saving={isSavingProviders || isSavingRouting}savedNote={notice}error={error}savingLabel={t('common.loading')}