Supersede draft PR #26 with a merge-safe prerequisite: bake and preload the amy, irina, and claude Piper models, route only validated server-side language to fixed voices, and leave the live voice deployment manifest unchanged. Remove the pinned WebUI speaker selector and its persisted preference, omit client voice fields from every outbound TTS path, and keep hands-free Voice Mode and the conversation instrument intact. Hostile or legacy voice fields remain ignored by the Piper server. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
45 lines
1.6 KiB
JavaScript
45 lines
1.6 KiB
JavaScript
const _SETTINGS_SPEECH_STORAGE_KEYS={
|
|
tts_engine:'hermes-tts-engine',
|
|
tts_voice:'hermes-tts-voice',
|
|
tts_rate:'hermes-tts-rate',
|
|
};
|
|
let _settingsSpeechChangedKeys=new Set();
|
|
|
|
function _speechPreferencesPayloadFromUi(){
|
|
const payload={};
|
|
const ttsVoiceSel=$('settingsTtsVoice');
|
|
if(ttsVoiceSel) _setOwnedSpeechPayload(payload,'tts_voice',ttsVoiceSel.value||'');
|
|
return payload;
|
|
}
|
|
|
|
function loadSettingsPanel(){
|
|
const ttsEngineSel=$('settingsTtsEngine');
|
|
if(ttsEngineSel){
|
|
ttsEngineSel.onchange=function(){
|
|
localStorage.setItem('hermes-tts-engine',this.value);
|
|
window._populateTtsVoices();
|
|
_schedulePreferencesAutosave();
|
|
};
|
|
}
|
|
// Populate voice selector based on engine
|
|
const ttsVoiceSel=$('settingsTtsVoice');
|
|
window._populateTtsVoices=function(){
|
|
if(!ttsVoiceSel) return;
|
|
const engine=localStorage.getItem('hermes-tts-engine')||'browser';
|
|
const current=String(_speechSetting('tts_voice','hermes-tts-voice','')||'');
|
|
_syncSpeechPreferenceCache('tts_voice',current);
|
|
if(engine==='edge'){
|
|
const edgeVoices=[
|
|
{value:'en-US-AriaNeural',label:'Aria (English, Female)'},
|
|
];
|
|
ttsVoiceSel.innerHTML='<option value="">Default (Xiaoxiao)</option>';
|
|
edgeVoices.forEach(v=>ttsVoiceSel.appendChild(v));
|
|
}
|
|
};
|
|
if(ttsVoiceSel&&'speechSynthesis' in window){
|
|
window._populateTtsVoices();
|
|
ttsVoiceSel.onchange=function(){_markSpeechPreferenceChanged('tts_voice');localStorage.setItem('hermes-tts-voice',this.value);_schedulePreferencesAutosave();};
|
|
}
|
|
// TTS rate/pitch sliders
|
|
}
|