mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-03 12:47:35 +01:00
Fix TTS speaking with disabled voice
This commit is contained in:
parent
47893b9a14
commit
0888cff254
@ -23,6 +23,7 @@ let lastChatId = null
|
||||
let lastMessageHash = null
|
||||
|
||||
const DEFAULT_VOICE_MARKER = '[Default Voice]';
|
||||
const DISABLED_VOICE_MARKER = 'disabled';
|
||||
|
||||
export function getPreviewString(lang) {
|
||||
const previewStrings = {
|
||||
@ -464,7 +465,7 @@ async function processTtsQueue() {
|
||||
|
||||
const voiceMapEntry = voiceMap[char] === DEFAULT_VOICE_MARKER ? voiceMap[DEFAULT_VOICE_MARKER] : voiceMap[char]
|
||||
|
||||
if (!voiceMapEntry) {
|
||||
if (!voiceMapEntry || voiceMapEntry === DISABLED_VOICE_MARKER) {
|
||||
throw `${char} not in voicemap. Configure character in extension settings voice map`
|
||||
}
|
||||
const voice = await ttsProvider.getVoice(voiceMapEntry)
|
||||
@ -717,8 +718,8 @@ class VoiceMapEntry {
|
||||
addUI(voiceIds){
|
||||
let sanitizedName = sanitizeId(this.name)
|
||||
let defaultOption = this.name === DEFAULT_VOICE_MARKER ?
|
||||
'<option>disabled</option>' :
|
||||
`<option>${DEFAULT_VOICE_MARKER}</option><option>disabled</option>`
|
||||
`<option>${DISABLED_VOICE_MARKER}</option>` :
|
||||
`<option>${DEFAULT_VOICE_MARKER}</option><option>${DISABLED_VOICE_MARKER}</option>`
|
||||
let template = `
|
||||
<div class='tts_voicemap_block_char flex-container flexGap5'>
|
||||
<span id='tts_voicemap_char_${sanitizedName}'>${this.name}</span>
|
||||
@ -808,7 +809,7 @@ export async function initVoiceMap(){
|
||||
if (character in voiceMapFromSettings){
|
||||
voiceId = voiceMapFromSettings[character]
|
||||
} else if (character === DEFAULT_VOICE_MARKER) {
|
||||
voiceId = 'disabled'
|
||||
voiceId = DISABLED_VOICE_MARKER
|
||||
} else {
|
||||
voiceId = DEFAULT_VOICE_MARKER
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user