From 96c2ccdfb100ff71e944488863b8793e78e5e474 Mon Sep 17 00:00:00 2001 From: G-Fourteen Date: Sat, 1 Nov 2025 05:28:41 -0600 Subject: [PATCH 1/7] Fix Talk to Unity launch URL --- landing.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/landing.js b/landing.js index a6d21d9..bba9168 100644 --- a/landing.js +++ b/landing.js @@ -120,8 +120,11 @@ document.addEventListener('DOMContentLoaded', () => { if (allMet) { // Set a cookie to indicate that the checks have passed document.cookie = "checks-passed=true;path=/"; - // Redirect to the AI page - window.location.href = '/ai/'; + // Redirect to the AI page relative to the current location so the + // experience keeps working when the site is hosted from a + // subdirectory (such as GitHub Pages). + const launchUrl = new URL('./AI/index.html', window.location.href); + window.location.assign(launchUrl.toString()); } }); From 68db464388643a344ce08452f8c5c60936af7b06 Mon Sep 17 00:00:00 2001 From: G-Fourteen Date: Sat, 1 Nov 2025 05:43:58 -0600 Subject: [PATCH 2/7] Fix AI experience redirects and expose UI controls for tests --- AI/app.js | 37 +++++++++++++++++++++++++++++-------- AI/index.html | 20 ++++++++++++++------ landing.js | 7 +++++-- 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/AI/app.js b/AI/app.js index 96d8bf8..76dc258 100644 --- a/AI/app.js +++ b/AI/app.js @@ -1,4 +1,12 @@ (() => { + if (typeof window !== 'undefined') { + window.addEventListener('error', (event) => { + if (event?.message) { + console.error('Talk to Unity runtime error:', event.message, event.error?.stack || ''); + } + }); + } + const landingSection = document.getElementById('landing'); const appRoot = document.getElementById('app-root'); const heroStage = document.getElementById('hero-stage'); @@ -415,12 +423,12 @@ } applyTheme(currentTheme); + setupSpeechRecognition(); if (!systemPromptLoaded) { await loadSystemPrompt(); } - setupSpeechRecognition(); updateMuteIndicator(); if (auto) { @@ -743,6 +751,14 @@ label: `Microphone error: ${event.error}` }); }; + + if (!isMuted) { + try { + recognition.start(); + } catch (error) { + console.error('Failed to start recognition after initialization:', error); + } + } } async function initializeVoiceControl() { @@ -929,12 +945,8 @@ .replace(/\ \[^]]*\bcommand\b[^]]*\]/gi, ' ') .replace(/\([^)]*\bcommand\b[^)]*\)/gi, ' ') .replace(/<[^>]*\bcommand\b[^>]*>/gi, ' ') - .replace(/\bcommands?\s*[:=-]\s*[a-z0-9_, -\s-]+ -/gi, ' ') - .replace(/\bactions?\s*[:=-]\s*[a-z0-9_, -\s-]+ -/gi, ' ') + .replace(/\bcommands?\s*[:=-]\s*[a-z0-9_,\s-]+/gi, ' ') + .replace(/\bactions?\s*[:=-]\s*[a-z0-9_,\s-]+/gi, ' ') .replace(/\b(?:execute|run)\s+command\s*(?:[:=-]\s*)?[a-z0-9_-]*/gi, ' ') .replace(/\bcommand\s*(?:[:=-]\s*|\s+)(?:[a-z0-9_-]+(?:\s+[a-z0-9_-]+)*)?/gi, ' '); @@ -1173,7 +1185,7 @@ } function escapeRegExp(value) { - return value.replace(/[-/\\^$*+?.()|[\{\}]/g, '\\$&'); + return value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); } function removeImageReferences(text, imageUrl) { @@ -1757,4 +1769,13 @@ window.open(imageUrl, '_blank'); speak('Image opened in new tab.'); } + + if (typeof window !== 'undefined') { + Object.assign(window, { + applyTheme, + setMutedState, + startApplication, + attemptUnmute + }); + } })(); diff --git a/AI/index.html b/AI/index.html index dad0f83..325bd22 100644 --- a/AI/index.html +++ b/AI/index.html @@ -13,17 +13,25 @@ - +