Fix duplicating entries if char and global WI are the same

This commit is contained in:
Cohee
2023-06-19 02:19:42 +03:00
parent 7e975e9df0
commit f51af31850
2 changed files with 8 additions and 2 deletions

View File

@@ -4806,7 +4806,8 @@ export function select_selected_character(chid) {
$("#renameCharButton").css("display", ""); $("#renameCharButton").css("display", "");
$('.open_alternate_greetings').data('chid', chid); $('.open_alternate_greetings').data('chid', chid);
$('#set_character_world').data('chid', chid); $('#set_character_world').data('chid', chid);
$('#set_character_world').toggleClass('world_set', !!(characters[chid].data?.extensions?.world)); const world = characters[chid].data?.extensions?.world;
$('#set_character_world').toggleClass('world_set', world && world_names.includes(world));
$("#form_create").attr("actiontype", "editcharacter"); $("#form_create").attr("actiontype", "editcharacter");
saveSettingsDebounced(); saveSettingsDebounced();

View File

@@ -555,8 +555,13 @@ async function getCharacterLore() {
return []; return [];
} }
if (name === world_info) {
console.debug(`Character ${characters[this_chid]?.name} world info is the same as global: ${name}. Skipping...`);
return [];
}
if (!world_names.includes(name)) { if (!world_names.includes(name)) {
console.warn(`Character ${characters[this_chid]?.name} has invalid world info name: ${name}`); console.log(`Character ${characters[this_chid]?.name} world info does not exist: ${name}`);
return []; return [];
} }