Files
pai-companion-voice-widget-…/www/index.html
nonna 2c369d74b1 Initial Neutralino.js POC for kokoro-widget
Lightweight alternative to the Electron build (~5MB vs ~300MB).
Uses system webview (WebKit2GTK on Linux, WKWebView on macOS,
WebView2 on Windows). Same UI and feature set as the Electron build:
WebSocket audio client, volume control, host/port settings, tray icon,
hide-to-tray on close, CLI args (--host, --port, --volume).

Note: Linux requires libwebkit2gtk-4.0 or libwebkit2gtk-4.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 00:44:45 +00:00

221 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PAI Voice</title>
<style>
:root {
--bg-primary: #0d1220;
--bg-secondary: #141c2c;
--bg-tertiary: #1c2638;
--text-primary: #f0f2f5;
--text-secondary: #c0c8d4;
--text-muted: #8a919d;
--cyan: #12c2e9;
--pink: #ff6b9d;
--teal: #2dd4bf;
--orange: #F39C12;
--border: rgba(255, 255, 255, 0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1rem;
user-select: none;
}
.voice-panel {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 16px;
padding: 1.5rem 2rem;
width: 300px;
text-align: center;
}
.panel-header {
cursor: move;
margin-bottom: 0.25rem;
padding-bottom: 0.25rem;
}
.voice-panel h1 {
font-size: 1.2rem;
font-weight: 700;
color: var(--cyan);
margin-bottom: 0;
}
.voice-panel .subtitle {
font-size: 0.75rem;
color: var(--text-muted);
margin-bottom: 1.25rem;
}
.status {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
margin-bottom: 1rem;
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--text-muted);
transition: background 0.3s, box-shadow 0.3s;
flex-shrink: 0;
}
.status-dot.connected { background: var(--teal); box-shadow: 0 0 8px rgba(45,212,191,0.4); }
.status-dot.connecting { background: var(--orange); animation: pulse 1.5s infinite; }
.status-dot.error { background: var(--pink); }
.status-text { color: var(--text-secondary); font-size: 0.85rem; }
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.speaking-indicator {
height: 36px;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
margin-bottom: 0.75rem;
opacity: 0;
transition: opacity 0.3s;
}
.speaking-indicator.active { opacity: 1; }
.speaking-bar { width: 4px; height: 8px; background: var(--cyan); border-radius: 2px; }
.speaking-indicator.active .speaking-bar { animation: bars 0.8s ease-in-out infinite; }
.speaking-bar:nth-child(1) { animation-delay: 0s; }
.speaking-bar:nth-child(2) { animation-delay: 0.1s; }
.speaking-bar:nth-child(3) { animation-delay: 0.2s; }
.speaking-bar:nth-child(4) { animation-delay: 0.3s; }
.speaking-bar:nth-child(5) { animation-delay: 0.2s; }
.speaking-bar:nth-child(6) { animation-delay: 0.1s; }
.speaking-bar:nth-child(7) { animation-delay: 0s; }
@keyframes bars {
0%, 100% { height: 8px; }
50% { height: 26px; }
}
.last-message {
font-size: 0.78rem;
color: var(--text-muted);
min-height: 1.4em;
margin-bottom: 1rem;
font-style: italic;
line-height: 1.4;
word-break: break-word;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 0 0 1rem 0; }
.volume-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.volume-row label {
font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase;
letter-spacing: 0.05em; white-space: nowrap; min-width: 3rem; text-align: left;
}
.volume-row input[type="range"] { flex: 1; accent-color: var(--cyan); cursor: pointer; }
.settings-section { border-top: 1px solid var(--border); padding-top: 1rem; text-align: left; }
.settings-section h3 {
font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase;
letter-spacing: 0.08em; margin-bottom: 0.75rem;
}
.settings-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.settings-row label {
font-size: 0.75rem; color: var(--text-secondary); min-width: 2.5rem; text-align: right;
}
.settings-row input {
flex: 1; background: var(--bg-tertiary); border: 1px solid var(--border);
border-radius: 6px; padding: 0.35rem 0.5rem; color: var(--text-primary);
font-size: 0.8rem; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.settings-row input:focus { border-color: rgba(18,194,233,0.5); }
.settings-row input[type="number"]::-webkit-outer-spin-button,
.settings-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.save-row { display: flex; justify-content: flex-end; margin-top: 0.75rem; }
#saveBtn {
background: var(--cyan); color: #0d1220; border: none; border-radius: 6px;
padding: 0.4rem 1.1rem; font-size: 0.8rem; font-weight: 600; font-family: inherit;
cursor: pointer; transition: opacity 0.2s;
}
#saveBtn:hover { opacity: 0.85; }
#saveBtn:active { opacity: 0.7; }
#saveBtn.saved { background: var(--teal); }
</style>
</head>
<body>
<div class="voice-panel">
<div class="panel-header" id="dragRegion">
<h1>PAI Voice</h1>
<p class="subtitle">Voice notifications from your AI assistant</p>
</div>
<div class="status">
<span class="status-dot connecting" id="statusDot"></span>
<span class="status-text" id="statusText">Connecting...</span>
</div>
<div class="speaking-indicator" id="speakingIndicator">
<div class="speaking-bar"></div>
<div class="speaking-bar"></div>
<div class="speaking-bar"></div>
<div class="speaking-bar"></div>
<div class="speaking-bar"></div>
<div class="speaking-bar"></div>
<div class="speaking-bar"></div>
</div>
<div class="last-message" id="lastMessage">Waiting for notifications...</div>
<hr class="divider">
<div class="volume-row">
<label for="volume">Volume</label>
<input type="range" id="volume" min="0" max="100" value="80">
</div>
<div class="settings-section">
<h3>Settings</h3>
<div class="settings-row">
<label for="hostInput">Host</label>
<input type="text" id="hostInput" placeholder="localhost" value="localhost">
</div>
<div class="settings-row">
<label for="portInput">Port</label>
<input type="number" id="portInput" placeholder="8888" value="8888" min="1" max="65535">
</div>
<div class="save-row">
<button id="saveBtn">Save</button>
</div>
</div>
</div>
<script src="neutralino.js"></script>
<script src="app.js"></script>
</body>
</html>