From 5b599b1617ce840182282b0a0943d50f65c76ca9 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Sun, 31 May 2026 19:39:51 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20voice=20=E2=80=94=20any=20speech=20=3D?= =?UTF-8?q?=20command=20when=20awake=20(no=20prefix=20lock),=20open=20wind?= =?UTF-8?q?ow=20on=20wake,=20transcript=20preview=20in=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public_html/index.html | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/public_html/index.html b/public_html/index.html index 1645441..2dc691e 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -1780,16 +1780,14 @@ function initVoice() { if (!voiceMode) { if (WAKE_PHRASES.some(p => lc.includes(p))) enterVoiceMode(); } else if (!voiceMuted) { + // Awake — any speech is a command; strip optional "jarvis" prefix voiceLastCmd = Date.now(); - const inWindow = voiceActive > 0 && (Date.now() - voiceActive) < VOICE_ACTIVE_MS; - let cmd = null; - if (lc.startsWith(CMD_PREFIX)) { - cmd = transcript.substring(CMD_PREFIX.length).trim(); - } else if (inWindow) { - cmd = transcript; - } + voiceActive = Date.now(); + const cmd = lc.startsWith(CMD_PREFIX) + ? transcript.substring(CMD_PREFIX.length).trim() + : transcript; if (cmd) { - voiceActive = Date.now(); + _showTranscript(cmd); document.getElementById('textInput').value = cmd; sendMessage(); } @@ -1817,10 +1815,16 @@ function initVoice() { }; } +function _showTranscript(text) { + const el = document.getElementById('textInput'); + if (el) { el.placeholder = '▶ ' + text.substring(0, 60); setTimeout(() => { el.placeholder = 'Enter command or speak to JARVIS...'; }, 3000); } +} + function enterVoiceMode() { voiceMode = true; voiceMuted = false; voiceLastCmd = Date.now(); + voiceActive = Date.now(); // open free-listen window immediately on wake updateMicBtn(); speak('Yes, ' + (sessionUser || 'Sir') + '?'); } @@ -1838,7 +1842,7 @@ function updateMicBtn() { if (!btn) return; if (!voiceMode) { btn.classList.remove('listening', 'muted'); - btn.title = 'Click to activate or say "Hey JARVIS"'; + btn.title = 'Click to activate, or say: wake up JARVIS / daddy\'s home'; icon.textContent = '🎤'; wave.classList.remove('active'); } else if (voiceMuted) {