feat: WebSocket команды — раздельная громкость mic/snd + запись аудио + обновлённый web-client
- satellite.py: разделён _runtime_volume на _runtime_mic_volume и _runtime_snd_volume - satellite.py: добавлены команды start_recording/stop_recording (WAV через base64) - satellite.py: метод _create_wav_from_buffer() для создания WAV из буфера - web-client: добавлен слайдер громкости микрофона (MIC+/MIC-) - web-client: добавлены кнопки записи и воспроизведения аудио - web-client: улучшенный лог событий и отладочные console.log - docs: websocket-server-plan.md сокращён с 1205 до ~80 строк Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -0,0 +1,456 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
body {
|
||||
background: radial-gradient(circle at 10% 20%, #0b1120, #04070c);
|
||||
font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Poppins', sans-serif;
|
||||
min-height: 100vh;
|
||||
padding: 24px;
|
||||
color: #eef5ff;
|
||||
}
|
||||
|
||||
.app-container {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Glassmorphism */
|
||||
.glass {
|
||||
background: rgba(15, 25, 45, 0.55);
|
||||
backdrop-filter: blur(16px);
|
||||
border-radius: 32px;
|
||||
border: 1px solid rgba(0, 255, 255, 0.15);
|
||||
box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.4);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.app-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24px;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, #a0f0ff, #6c63ff);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
font-size: 2rem;
|
||||
filter: drop-shadow(0 0 6px cyan);
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.connection-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 8px 20px;
|
||||
border-radius: 60px;
|
||||
}
|
||||
|
||||
.led {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background: #ff4d4d;
|
||||
box-shadow: 0 0 6px #ff4d4d;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.led.connected {
|
||||
background: #0ff;
|
||||
box-shadow: 0 0 12px #0ff;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-weight: 500;
|
||||
font-family: monospace;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.settings-card {
|
||||
padding: 16px 24px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.settings-row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.input-url {
|
||||
flex: 1;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border: 1px solid rgba(0, 255, 255, 0.3);
|
||||
border-radius: 40px;
|
||||
padding: 10px 18px;
|
||||
color: #eef5ff;
|
||||
font-size: 0.9rem;
|
||||
outline: none;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.input-url:focus {
|
||||
border-color: cyan;
|
||||
box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.auto-connect {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: #aaa;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dashboard {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.1fr 0.9fr;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 24px;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
border-left: 3px solid #0ff;
|
||||
padding-left: 14px;
|
||||
}
|
||||
|
||||
.card-header h3 {
|
||||
font-weight: 500;
|
||||
font-size: 1.1rem;
|
||||
letter-spacing: 0.5px;
|
||||
color: #bfd9ff;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
/* Голосовая сфера */
|
||||
.avatar-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.orb {
|
||||
position: relative;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.orb-inner {
|
||||
width: 130px;
|
||||
height: 130px;
|
||||
background: radial-gradient(circle at 35% 35%, #1ad, #0a4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 3.5rem;
|
||||
box-shadow: 0 0 30px rgba(0, 255, 200, 0.4);
|
||||
transition: all 0.2s ease;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.orb-pulse {
|
||||
position: absolute;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 50%;
|
||||
background: rgba(0, 255, 200, 0.2);
|
||||
animation: pulse-ring 2s infinite;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes pulse-ring {
|
||||
0% { transform: scale(0.9); opacity: 0.6; }
|
||||
100% { transform: scale(1.4); opacity: 0; }
|
||||
}
|
||||
|
||||
/* Активное слушание */
|
||||
.listening-active .orb-inner {
|
||||
animation: listen-pulse 0.8s infinite alternate;
|
||||
box-shadow: 0 0 50px cyan;
|
||||
}
|
||||
|
||||
@keyframes listen-pulse {
|
||||
0% { transform: scale(1); background: radial-gradient(circle at 35% 35%, #1ad, #0a4); }
|
||||
100% { transform: scale(1.05); background: radial-gradient(circle at 35% 35%, #3ff, #2c9); }
|
||||
}
|
||||
|
||||
.state-badge {
|
||||
background: rgba(0, 255, 255, 0.15);
|
||||
backdrop-filter: blur(4px);
|
||||
padding: 6px 18px;
|
||||
border-radius: 40px;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Визуализатор */
|
||||
.viz-wrapper {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 24px;
|
||||
padding: 12px;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
display: block;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
/* RMS meter */
|
||||
.rms-container {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.rms-label {
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: #8aa;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.rms-bar {
|
||||
height: 6px;
|
||||
background: #1e2a3a;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.rms-fill {
|
||||
height: 100%;
|
||||
width: 0%;
|
||||
background: linear-gradient(90deg, #0ff, #f0f);
|
||||
border-radius: 3px;
|
||||
transition: width 0.08s linear;
|
||||
}
|
||||
|
||||
.rms-value {
|
||||
font-family: monospace;
|
||||
font-size: 0.8rem;
|
||||
text-align: right;
|
||||
color: cyan;
|
||||
}
|
||||
|
||||
.volume-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin: 20px 0 12px;
|
||||
}
|
||||
|
||||
.volume-control span:first-child {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.volume-control input {
|
||||
flex: 1;
|
||||
height: 4px;
|
||||
-webkit-appearance: none;
|
||||
appearance: none; /* стандартное свойство для совместимости */
|
||||
background: #2a3a4a;
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.volume-control input::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: cyan;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 0 6px cyan;
|
||||
}
|
||||
|
||||
.volume-percent {
|
||||
width: 45px;
|
||||
text-align: right;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin: 16px 0 8px;
|
||||
}
|
||||
|
||||
.btn-primary, .btn-secondary, .btn-danger, .btn-outline {
|
||||
padding: 8px 18px;
|
||||
border-radius: 40px;
|
||||
font-weight: 500;
|
||||
font-size: 0.8rem;
|
||||
cursor: pointer;
|
||||
transition: 0.15s;
|
||||
border: none;
|
||||
background: rgba(20, 30, 50, 0.7);
|
||||
backdrop-filter: blur(4px);
|
||||
color: #eef5ff;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
letter-spacing: 0.5px;
|
||||
border: 1px solid rgba(0, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: rgba(0, 200, 255, 0.2);
|
||||
border-color: #0ff;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: rgba(0, 200, 255, 0.4);
|
||||
box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: rgba(100, 100, 200, 0.3);
|
||||
border-color: #8af;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
border-color: #ff66aa;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #ff336620;
|
||||
border-color: #ff88cc;
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background: transparent;
|
||||
border-color: #6c7a8a;
|
||||
}
|
||||
.btn-outline:hover {
|
||||
border-color: cyan;
|
||||
background: rgba(0, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.full-width {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.transcript-area {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 24px;
|
||||
padding: 16px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.transcript-item {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.transcript-label {
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
color: #8ad;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.transcript-text {
|
||||
font-style: italic;
|
||||
color: #f0f9ff;
|
||||
word-break: break-word;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.status-grid {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.status-chip {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 6px 14px;
|
||||
border-radius: 40px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.event-feed {
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
border-radius: 20px;
|
||||
height: 220px;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
font-family: monospace;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.event-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid #2a4c6e50;
|
||||
color: #bde;
|
||||
}
|
||||
|
||||
@media (max-width: 1000px) {
|
||||
.dashboard {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
body {
|
||||
padding: 16px;
|
||||
}
|
||||
.orb {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
.orb-inner {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user