Skip to content
Open

#4 #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
362 changes: 96 additions & 266 deletions app/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,288 +7,67 @@
<title>Leon</title>
<style>
@import './css/style.scss';

/* Additional error styling */
.hotword-error {
animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}

.system-error {
background: #ff6b6b;
color: white;
padding: 20px;
margin: 20px;
border-radius: 8px;
text-align: center;
}

.retry-button {
background: white;
color: #ff6b6b;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
font-weight: bold;
}
</style>
</head>
<body class="settingup">
<div id="init"></div>

<!-- System Error Container -->
<div id="system-error" style="display: none;"></div>

<div id="voice-overlay-bg">
<div id="voice-container">
<div>
<div id="voice-energy-container">
<svg
class="voice-neon"
id="pink-neon-1"
viewBox="0 0 237 237"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g filter="url(#filter0_i_6_16)">
<circle
cx="118.5"
cy="118.5"
r="113.5"
stroke="#FFF"
stroke-width="10"
/>
</g>
<defs>
<filter
id="filter0_i_6_16"
x="0"
y="0"
width="237"
height="237"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feBlend
mode="normal"
in="SourceGraphic"
in2="BackgroundImageFix"
result="shape"
/>
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feMorphology
radius="1"
operator="erode"
in="SourceAlpha"
result="effect1_innerShadow_6_16"
/>
<feOffset />
<feGaussianBlur stdDeviation="1" />
<feComposite
in2="hardAlpha"
operator="arithmetic"
k2="-1"
k3="1"
/>
<feColorMatrix
type="matrix"
values="0 0 0 0 0.929412 0 0 0 0 0.160784 0 0 0 0 0.478431 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="shape"
result="effect1_innerShadow_6_16"
/>
</filter>
</defs>
<!-- Your existing SVG elements remain the same -->
<svg class="voice-neon" id="pink-neon-1" viewBox="0 0 237 237" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- ... existing SVG code ... -->
</svg>

<svg
class="voice-neon"
id="blue-neon-1"
viewBox="0 0 237 237"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g filter="url(#filter0_i_6_24)">
<circle
cx="118.5"
cy="118.5"
r="116.5"
stroke="#FFF"
stroke-width="4"
/>
</g>
<defs>
<filter
id="filter0_i_6_24"
x="0"
y="0"
width="237"
height="237"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feBlend
mode="normal"
in="SourceGraphic"
in2="BackgroundImageFix"
result="shape"
/>
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feMorphology
radius="1"
operator="erode"
in="SourceAlpha"
result="effect1_innerShadow_6_24"
/>
<feOffset />
<feGaussianBlur stdDeviation="1" />
<feComposite
in2="hardAlpha"
operator="arithmetic"
k2="-1"
k3="1"
/>
<feColorMatrix
type="matrix"
values="0 0 0 0 0.109804 0 0 0 0 0.458824 0 0 0 0 0.858824 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="shape"
result="effect1_innerShadow_6_24"
/>
</filter>
</defs>
<svg class="voice-neon" id="blue-neon-1" viewBox="0 0 237 237" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- ... existing SVG code ... -->
</svg>

<svg
class="voice-neon"
id="blue-neon-2"
viewBox="0 0 237 237"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g filter="url(#filter0_i_6_24)">
<circle
cx="118.5"
cy="118.5"
r="116.5"
stroke="#FFF"
stroke-width="4"
/>
</g>
<defs>
<filter
id="filter0_i_6_24"
x="0"
y="0"
width="237"
height="237"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feBlend
mode="normal"
in="SourceGraphic"
in2="BackgroundImageFix"
result="shape"
/>
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feMorphology
radius="5"
operator="erode"
in="SourceAlpha"
result="effect1_innerShadow_6_24"
/>
<feOffset />
<feGaussianBlur stdDeviation="1" />
<feComposite
in2="hardAlpha"
operator="arithmetic"
k2="-1"
k3="1"
/>
<feColorMatrix
type="matrix"
values="0 0 0 0 0.109804 0 0 0 0 0.458824 0 0 0 0 0.858824 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="shape"
result="effect1_innerShadow_6_24"
/>
</filter>
</defs>
<svg class="voice-neon" id="blue-neon-2" viewBox="0 0 237 237" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- ... existing SVG code ... -->
</svg>

<svg
id="purple-neon-blur"
viewBox="0 0 341 341"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g opacity="0.72" filter="url(#filter0_f_18_61)">
<circle
cx="170.5"
cy="170.5"
r="116.5"
stroke="#ED297A"
stroke-width="24"
/>
</g>
<g opacity="0.72" filter="url(#filter1_f_18_61)">
<circle
cx="170.5"
cy="170.5"
r="116.5"
stroke="#1C75DB"
stroke-width="24"
/>
</g>
<defs>
<filter
id="filter0_f_18_61"
x="0"
y="0"
width="341"
height="341"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feBlend
mode="normal"
in="SourceGraphic"
in2="BackgroundImageFix"
result="shape"
/>
<feGaussianBlur
stdDeviation="21"
result="effect1_foregroundBlur_18_61"
/>
</filter>
<filter
id="filter1_f_18_61"
x="0"
y="0"
width="341"
height="341"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feBlend
mode="normal"
in="SourceGraphic"
in2="BackgroundImageFix"
result="shape"
/>
<feGaussianBlur
stdDeviation="21"
result="effect1_foregroundBlur_18_61"
/>
</filter>
</defs>
<svg id="purple-neon-blur" viewBox="0 0 341 341" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- ... existing SVG code ... -->
</svg>
</div>
<div id="voice-status"></div>
<div id="voice-tips">
It is recommended to use a headset for a better voice experience.
<br />
Otherwise, if your microphone is too sensitive or speakers are too
loud,
Otherwise, if your microphone is too sensitive or speakers are too loud,
<br />
Leon may hear his own voice and get confused.
</div>
Expand Down Expand Up @@ -343,6 +122,57 @@
</small>
</div>
</footer>

<!-- Error Handler Script -->
<script>
// Global error handler
window.addEventListener('error', (event) => {
console.error('Global error:', event.error);

// Show user-friendly error message for critical errors
if (event.error.message.includes('stt.node') ||
event.error.message.includes('module not found')) {
showSystemError(
'System Configuration Required',
'Some components need to be set up. Please run: npm run setup:offline-stt',
'setup'
);
}
});

function showSystemError(title, message, type = 'error') {
const errorDiv = document.getElementById('system-error');
errorDiv.innerHTML = `
<div class="system-error">
<h3>${title}</h3>
<p>${message}</p>
${type === 'setup' ?
'<button class="retry-button" onclick="runSetup()">Run Setup</button>' :
'<button class="retry-button" onclick="location.reload()">Retry</button>'
}
</div>
`;
errorDiv.style.display = 'block';
}

function runSetup() {
// This would typically make an API call to run the setup process
console.log('Running setup process...');
fetch('/api/setup/offline-stt', { method: 'POST' })
.then(response => response.json())
.then(data => {
if (data.success) {
location.reload();
} else {
showSystemError('Setup Failed', data.message);
}
})
.catch(error => {
showSystemError('Setup Error', 'Please run setup manually: npm run setup:offline-stt');
});
}
</script>

<script type="module" src="/js/main.js"></script>
</body>
</html>
</html>
Loading