From 58462d96d2e9a5cd64684932ab951f1a08174ed8 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 1 Jan 2024 20:22:48 +0200 Subject: [PATCH] Fix RVC after converting to group --- public/scripts/extensions/tts/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index e4f7a0a91..a7f3e4eea 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -1,6 +1,6 @@ import { callPopup, cancelTtsPlay, eventSource, event_types, name2, saveSettingsDebounced } from '../../../script.js'; import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext, modules } from '../../extensions.js'; -import { delay, escapeRegex, getStringHash } from '../../utils.js'; +import { delay, escapeRegex, getStringHash, onlyUnique } from '../../utils.js'; import { EdgeTtsProvider } from './edge.js'; import { ElevenLabsTtsProvider } from './elevenlabs.js'; import { SileroTtsProvider } from './silerotts.js'; @@ -733,7 +733,7 @@ function getCharacters(unrestricted) { if (unrestricted) { const names = context.characters.map(char => char.name); names.unshift(DEFAULT_VOICE_MARKER); - return names; + return names.filter(onlyUnique); } let characters = []; @@ -748,14 +748,13 @@ function getCharacters(unrestricted) { characters.push(context.name1); const group = context.groups.find(group => context.groupId == group.id); for (let member of group.members) { - // Remove suffix - if (member.endsWith('.png')) { - member = member.slice(0, -4); + const character = context.characters.find(char => char.avatar == member); + if (character) { + characters.push(character.name); } - characters.push(member); } } - return characters; + return characters.filter(onlyUnique); } function sanitizeId(input) {