feat(voice): implementa voz y TTS en chats POS y dashboard

- Agrega TTS (speechSynthesis) a chat.js del POS para leer respuestas IA
- Copia lógica de voz completa (STT + TTS) a dashboard/chat-public.js
- Extiende estilos TTS en chat.css y chat-public.css
- Agrega chat widget a 13 templates POS que no lo tenían
- Corrige duplicado de chat.css en diagrams.html
- Minifica assets actualizados
- 73/73 tests pasan
This commit is contained in:
2026-04-28 00:53:57 +00:00
parent 1f909f4c42
commit afb3b2405c
20 changed files with 443 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/* ==========================================================================
NEXUS — Public Catalog Chat Widget
NEXUS — Public Catalog Chat Widget (Voice + TTS enabled)
Reuses design tokens from tokens.css
========================================================================== */
@@ -228,6 +228,99 @@
.chat-send-btn:hover { background: var(--color-primary-hover, #e5952f); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* ─── Header Actions (TTS toggle + close) ─── */
.chat-header-actions {
display: flex;
align-items: center;
gap: 8px;
}
.chat-tts-toggle {
background: none;
border: none;
color: #fff;
font-size: 1rem;
cursor: pointer;
padding: 4px;
line-height: 1;
opacity: 0.9;
transition: opacity 0.15s ease;
}
.chat-tts-toggle:hover { opacity: 1; }
.chat-tts-toggle.off { opacity: 0.4; }
/* ─── Mic Button (Voice Input) ─── */
.chat-mic-btn {
width: 38px;
height: 38px;
border-radius: 8px;
border: 1px solid var(--color-border, #333);
background: var(--color-bg-base, #111);
color: var(--color-text-secondary, #aaa);
font-size: 1.1rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chat-mic-btn:hover {
border-color: var(--color-accent, #F5A623);
color: var(--color-accent, #F5A623);
}
.chat-mic-btn.listening {
background: #f85149;
border-color: #f85149;
color: #fff;
animation: micPulse 1.4s infinite;
}
@keyframes micPulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.4); }
50% { box-shadow: 0 0 0 10px rgba(248, 81, 73, 0); }
}
/* ─── TTS Button ─── */
.chat-tts-btn {
background: none;
border: none;
color: #8b949e;
font-size: 0.85rem;
cursor: pointer;
padding: 2px 4px;
margin-left: 6px;
border-radius: 4px;
transition: color 0.2s, background 0.2s;
}
.chat-tts-btn:hover { color: #58a6ff; background: rgba(88,166,255,0.1); }
.chat-tts-btn.tts-active { color: #58a6ff; }
/* ─── Voice Toast ─── */
.chat-voice-toast {
position: fixed;
bottom: 160px;
left: 50%;
transform: translateX(-50%) translateY(10px);
background: rgba(0, 0, 0, 0.8);
color: #fff;
padding: 8px 18px;
border-radius: 8px;
font-size: 0.85rem;
z-index: 9999;
opacity: 0;
transition: opacity 0.3s, transform 0.3s;
pointer-events: none;
}
.chat-voice-toast.visible {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
@media (max-width: 480px) {
.chat-panel {
width: calc(100vw - 16px);