TTS: Avoid default voice selector display itself

This commit is contained in:
Jasonnor 2023-09-03 23:38:34 +08:00
parent f91e1dfd86
commit 6d2caf94bf
1 changed files with 5 additions and 3 deletions

View File

@ -716,12 +716,14 @@ class VoiceMapEntry {
addUI(voiceIds){ addUI(voiceIds){
let sanitizedName = sanitizeId(this.name) let sanitizedName = sanitizeId(this.name)
let defaultOption = this.name === DEFAULT_VOICE_MARKER ?
'<option>disabled</option>' :
`<option>${DEFAULT_VOICE_MARKER}</option><option>disabled</option>`
let template = ` let template = `
<div class='tts_voicemap_block_char flex-container flexGap5'> <div class='tts_voicemap_block_char flex-container flexGap5'>
<span id='tts_voicemap_char_${sanitizedName}'>${this.name}</span> <span id='tts_voicemap_char_${sanitizedName}'>${this.name}</span>
<select id='tts_voicemap_char_${sanitizedName}_voice'> <select id='tts_voicemap_char_${sanitizedName}_voice'>
<option>${DEFAULT_VOICE_MARKER}</option> ${defaultOption}
<option>disabled</option>
</select> </select>
</div> </div>
` `
@ -808,7 +810,7 @@ export async function initVoiceMap(){
} else if (character === DEFAULT_VOICE_MARKER) { } else if (character === DEFAULT_VOICE_MARKER) {
voiceId = 'disabled' voiceId = 'disabled'
} else { } else {
voiceId = '[Default Voice]' voiceId = DEFAULT_VOICE_MARKER
} }
const voiceMapEntry = new VoiceMapEntry(character, voiceId) const voiceMapEntry = new VoiceMapEntry(character, voiceId)
voiceMapEntry.addUI(voiceIdsFromProvider) voiceMapEntry.addUI(voiceIdsFromProvider)