mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix TTS speaking with disabled voice
This commit is contained in:
@@ -23,6 +23,7 @@ let lastChatId = null
|
|||||||
let lastMessageHash = null
|
let lastMessageHash = null
|
||||||
|
|
||||||
const DEFAULT_VOICE_MARKER = '[Default Voice]';
|
const DEFAULT_VOICE_MARKER = '[Default Voice]';
|
||||||
|
const DISABLED_VOICE_MARKER = 'disabled';
|
||||||
|
|
||||||
export function getPreviewString(lang) {
|
export function getPreviewString(lang) {
|
||||||
const previewStrings = {
|
const previewStrings = {
|
||||||
@@ -464,7 +465,7 @@ async function processTtsQueue() {
|
|||||||
|
|
||||||
const voiceMapEntry = voiceMap[char] === DEFAULT_VOICE_MARKER ? voiceMap[DEFAULT_VOICE_MARKER] : voiceMap[char]
|
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`
|
throw `${char} not in voicemap. Configure character in extension settings voice map`
|
||||||
}
|
}
|
||||||
const voice = await ttsProvider.getVoice(voiceMapEntry)
|
const voice = await ttsProvider.getVoice(voiceMapEntry)
|
||||||
@@ -717,8 +718,8 @@ class VoiceMapEntry {
|
|||||||
addUI(voiceIds){
|
addUI(voiceIds){
|
||||||
let sanitizedName = sanitizeId(this.name)
|
let sanitizedName = sanitizeId(this.name)
|
||||||
let defaultOption = this.name === DEFAULT_VOICE_MARKER ?
|
let defaultOption = this.name === DEFAULT_VOICE_MARKER ?
|
||||||
'<option>disabled</option>' :
|
`<option>${DISABLED_VOICE_MARKER}</option>` :
|
||||||
`<option>${DEFAULT_VOICE_MARKER}</option><option>disabled</option>`
|
`<option>${DEFAULT_VOICE_MARKER}</option><option>${DISABLED_VOICE_MARKER}</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>
|
||||||
@@ -808,7 +809,7 @@ export async function initVoiceMap(){
|
|||||||
if (character in voiceMapFromSettings){
|
if (character in voiceMapFromSettings){
|
||||||
voiceId = voiceMapFromSettings[character]
|
voiceId = voiceMapFromSettings[character]
|
||||||
} else if (character === DEFAULT_VOICE_MARKER) {
|
} else if (character === DEFAULT_VOICE_MARKER) {
|
||||||
voiceId = 'disabled'
|
voiceId = DISABLED_VOICE_MARKER
|
||||||
} else {
|
} else {
|
||||||
voiceId = DEFAULT_VOICE_MARKER
|
voiceId = DEFAULT_VOICE_MARKER
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user