diff --git a/public_html/index.html b/public_html/index.html
index 33d3901..9ba52b1 100644
--- a/public_html/index.html
+++ b/public_html/index.html
@@ -919,10 +919,12 @@ const IDLE_RELOAD_MS = 5 * 60 * 1000; // 5 min inactivity → full reload
let voiceMode = false; // true = JARVIS awake (listening for commands)
let voiceMuted = false; // true = awake but mic muted
let voiceLastCmd = 0;
-const VOICE_SLEEP_MS = 30 * 60 * 1000; // 30 min voice inactivity → sleep
+const VOICE_SLEEP_MS = 30 * 60 * 1000; // 30 min voice inactivity → sleep
+const VOICE_ACTIVE_MS = 17000; // 17s active window after each command
+let voiceActive = 0; // timestamp of last issued command
// Phase 1: full phrase required to wake from sleep
const WAKE_PHRASES = ["wake up jarvis", "daddy's home", "wake up, jarvis", "daddys home"];
-// Phase 2: command prefix when awake — "jarvis "
+// Phase 2: command prefix — "jarvis "; then 17s free-listen window
const CMD_PREFIX = 'jarvis';
const FACE_MODEL_URL = 'https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js@0.22.2/weights';
@@ -1747,14 +1749,19 @@ function initVoice() {
// Sleeping — full wake phrase required
if (WAKE_PHRASES.some(p => lc.includes(p))) enterVoiceMode();
} else if (!voiceMuted) {
- // Awake — must start with "Jarvis" to trigger a command
- voiceLastCmd = Date.now(); // any speech resets inactivity timer
+ // Awake — "Jarvis " triggers command; active window allows free speech
+ voiceLastCmd = Date.now(); // any detected speech resets 30-min sleep timer
+ const inWindow = voiceActive > 0 && (Date.now() - voiceActive) < VOICE_ACTIVE_MS;
+ let cmd = null;
if (lc.startsWith(CMD_PREFIX)) {
- const cmd = transcript.substring(CMD_PREFIX.length).trim();
- if (cmd) {
- document.getElementById('textInput').value = cmd;
- sendMessage();
- }
+ cmd = transcript.substring(CMD_PREFIX.length).trim();
+ } else if (inWindow) {
+ cmd = transcript; // active window: no prefix needed
+ }
+ if (cmd) {
+ voiceActive = Date.now(); // reset 17s window
+ document.getElementById('textInput').value = cmd;
+ sendMessage();
}
}
};