mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 11:10:18 +00:00
fix: voice-mode pref toggle-off now stops the recognizer (#1491)
When a user disables 'Hands-free voice mode' in Settings while voice mode is active, the button hides but the SpeechRecognition keeps running — the user can't stop it because the button is invisible. Fix: _applyVoiceModePref() now checks if voice mode is active and calls _deactivate() when the pref is toggled off. Move _voiceModeActive declaration above the function to avoid TDZ. Also removes a duplicate window._applyVoiceModePref assignment.
This commit is contained in:
+5
-2
@@ -470,14 +470,17 @@ window._micPendingSend=window._micPendingSend||false;
|
||||
try{ return localStorage.getItem('hermes-voice-mode-button')==='true'; }
|
||||
catch(_){ return false; }
|
||||
}
|
||||
let _voiceModeActive=false;
|
||||
|
||||
function _applyVoiceModePref(){
|
||||
modeBtn.style.display = _voiceModePrefEnabled() ? '' : 'none';
|
||||
const enabled = _voiceModePrefEnabled();
|
||||
modeBtn.style.display = enabled ? '' : 'none';
|
||||
if(!enabled && _voiceModeActive) _deactivate();
|
||||
}
|
||||
_applyVoiceModePref();
|
||||
// Expose so the settings pane can re-apply immediately on toggle.
|
||||
window._applyVoiceModePref = _applyVoiceModePref;
|
||||
|
||||
let _voiceModeActive=false;
|
||||
let _voiceModeState='idle'; // idle | listening | thinking | speaking
|
||||
let _recognition=null;
|
||||
let _silenceTimer=null;
|
||||
|
||||
Reference in New Issue
Block a user