diff --git a/static/app.js b/static/app.js index 725b989..79eb23e 100644 --- a/static/app.js +++ b/static/app.js @@ -1,6 +1,322 @@ // ── Utility ─────────────────────────────────────────────────────────────── const $ = id => document.getElementById(id); + +// ── Voice avatar colors ─────────────────────────────────────────────────── +const _AVATAR_COLORS = ['#E57373','#F06292','#BA68C8','#9575CD','#7986CB', + '#64B5F6','#4DD0E1','#4DB6AC','#81C784','#FFB74D','#FF8A65','#A1887F']; +function avatarColor(id) { + let h = 0; + for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) & 0xFFFFFF; + return _AVATAR_COLORS[Math.abs(h) % _AVATAR_COLORS.length]; +} + +// ── Voice inspector (3-pane workbench) ─────────────────────────────────── +let _selectedVoiceWrap = null; + +function selectVoice(wrap) { + const inspector = document.getElementById('voices-inspector'); + if (!inspector) return; + + function restoreToRow(targetWrap) { + // Restore all extracted elements back to their original DOM parents + (targetWrap._extracted || []).forEach(({el, target}) => { + if (el && target) target.appendChild(el); + }); + targetWrap._extracted = []; + // Move main-row and optimizer back from inspector body to wrap + inspector.querySelectorAll('.vr-main-row,.vr-optimizer').forEach(el => targetWrap.appendChild(el)); + } + + // Deselect previous voice + if (_selectedVoiceWrap && _selectedVoiceWrap !== wrap) { + _selectedVoiceWrap.classList.remove('vr-selected'); + restoreToRow(_selectedVoiceWrap); + } + + if (_selectedVoiceWrap === wrap) { + restoreToRow(wrap); + wrap.classList.remove('vr-selected'); + _selectedVoiceWrap = null; + inspector.innerHTML = '
Pick a voice on the left
to edit it here
Set the path where your .wav voice files live inside the container.
Map a host folder via docker-compose:
+ - /your/host/path:/voices:rw
+ or set VOICE_HOST_DIR=/your/host/path in the stack env.
Create your first voice from a recording or download ready-made voices.
+Preview first. Saving creates a new active WAV voice from the current reference text. Same-voice style only works when the selected backend knows this voice and honors instruct; Base/Streaming are fastest but often ignore style.