mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-12 17:36:22 +01:00
#1077 Add ability to set default voice
This commit is contained in:
parent
7a325f03ea
commit
79dcfa6c51
@ -22,6 +22,8 @@ let lastGroupId = null
|
|||||||
let lastChatId = null
|
let lastChatId = null
|
||||||
let lastMessageHash = null
|
let lastMessageHash = null
|
||||||
|
|
||||||
|
const DEFAULT_VOICE_MARKER = '[Default Voice]';
|
||||||
|
|
||||||
export function getPreviewString(lang) {
|
export function getPreviewString(lang) {
|
||||||
const previewStrings = {
|
const previewStrings = {
|
||||||
'en-US': 'The quick brown fox jumps over the lazy dog',
|
'en-US': 'The quick brown fox jumps over the lazy dog',
|
||||||
@ -460,10 +462,12 @@ async function processTtsQueue() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!voiceMap[char]) {
|
const voiceMapEntry = voiceMap[char] || voiceMap[DEFAULT_VOICE_MARKER]
|
||||||
|
|
||||||
|
if (!voiceMapEntry) {
|
||||||
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((voiceMap[char]))
|
const voice = await ttsProvider.getVoice(voiceMapEntry)
|
||||||
const voiceId = voice.voice_id
|
const voiceId = voice.voice_id
|
||||||
if (voiceId == null) {
|
if (voiceId == null) {
|
||||||
toastr.error(`Specified voice for ${char} was not found. Check the TTS extension settings.`)
|
toastr.error(`Specified voice for ${char} was not found. Check the TTS extension settings.`)
|
||||||
@ -636,10 +640,12 @@ function getCharacters(){
|
|||||||
let characters = []
|
let characters = []
|
||||||
if (context.groupId === null){
|
if (context.groupId === null){
|
||||||
// Single char chat
|
// Single char chat
|
||||||
|
characters.push(DEFAULT_VOICE_MARKER)
|
||||||
characters.push(context.name1)
|
characters.push(context.name1)
|
||||||
characters.push(context.name2)
|
characters.push(context.name2)
|
||||||
} else {
|
} else {
|
||||||
// Group chat
|
// Group chat
|
||||||
|
characters.push(DEFAULT_VOICE_MARKER)
|
||||||
characters.push(context.name1)
|
characters.push(context.name1)
|
||||||
const group = context.groups.find(group => context.groupId == group.id)
|
const group = context.groups.find(group => context.groupId == group.id)
|
||||||
for (let member of group.members) {
|
for (let member of group.members) {
|
||||||
|
Loading…
Reference in New Issue
Block a user