Fix RVC after converting to group

This commit is contained in:
Cohee 2024-01-01 20:22:48 +02:00
parent 52637ccd39
commit 58462d96d2

View File

@ -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) {