From bbf277f5247a3eaaac62d3e02ef3c27ccc7f7abb Mon Sep 17 00:00:00 2001 From: G-Fourteen Date: Fri, 31 Oct 2025 19:04:00 -0600 Subject: [PATCH] Improve voice circle feedback and prompt diagnostics --- app.js | 21 ++++++++++++++++++--- index.html | 16 ++++++++++++++-- style.css | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index fcd17e0..006aeb9 100644 --- a/app.js +++ b/app.js @@ -66,8 +66,15 @@ function setCircleState(circle, { speaking = false, listening = false, error = f circle.classList.toggle('is-error', error); circle.classList.toggle('is-active', speaking || listening || error); - if (label) { - circle.setAttribute('aria-label', label); + const resolvedLabel = label || circle.dataset.defaultLabel || ''; + + if (resolvedLabel) { + circle.setAttribute('aria-label', resolvedLabel); + } + + const statusText = circle.querySelector('.status-text'); + if (statusText && resolvedLabel) { + statusText.textContent = resolvedLabel; } } @@ -122,11 +129,19 @@ function updateBackgroundLinkOverlay(urls) { async function loadSystemPrompt() { try { - const response = await fetch(resolveAssetPath('ai-instruct.txt')); + const response = await fetch(resolveAssetPath('ai-instruct.txt'), { + cache: 'no-store' + }); systemPrompt = await response.text(); + document.body.dataset.systemPromptStatus = 'loaded'; + console.info( + '[Unity Voice]', + `System prompt loaded (${systemPrompt.length} characters)` + ); } catch (error) { console.error('Error fetching system prompt:', error); systemPrompt = 'You are Unity, a helpful AI assistant.'; + document.body.dataset.systemPromptStatus = 'fallback'; } } diff --git a/index.html b/index.html index 1ce0549..302629b 100644 --- a/index.html +++ b/index.html @@ -16,12 +16,24 @@
-
+
+ Unity
-
+
+ You
diff --git a/style.css b/style.css index b752c3b..aa3e919 100644 --- a/style.css +++ b/style.css @@ -170,6 +170,30 @@ body { border-color: rgba(67, 217, 189, 0.6); } +.voice-circle .status-text { + position: relative; + z-index: 2; + padding: 0 18px; + text-align: center; + font-size: clamp(0.82rem, 2.4vw, 1rem); + font-weight: 500; + letter-spacing: 0.03em; + color: rgba(245, 245, 245, 0.88); + transition: color 0.4s ease; +} + +.voice-circle.is-error .status-text { + color: rgba(255, 161, 181, 0.95); +} + +.voice-circle.is-speaking .status-text { + color: rgba(255, 255, 255, 0.96); +} + +.voice-circle.is-listening.user .status-text { + color: rgba(193, 255, 244, 0.96); +} + .voice-circle.is-speaking { box-shadow: 0 0 54px -16px rgba(255, 255, 255, 0.75); transform: translateY(-6px) scale(1.05);