mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #576 from bdashore3/dev
World Info: Fix lorebook loading error
This commit is contained in:
@ -250,7 +250,7 @@ function displayWorldEntries(name, data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingCharLores = world_info.charLore.filter((e) => e.extraBooks.includes(name));
|
const existingCharLores = world_info.charLore?.filter((e) => e.extraBooks.includes(name));
|
||||||
if (existingCharLores && existingCharLores.length > 0) {
|
if (existingCharLores && existingCharLores.length > 0) {
|
||||||
existingCharLores.forEach((charLore) => {
|
existingCharLores.forEach((charLore) => {
|
||||||
const tempCharLore = charLore.extraBooks.filter((e) => e !== name);
|
const tempCharLore = charLore.extraBooks.filter((e) => e !== name);
|
||||||
@ -627,7 +627,7 @@ async function renameWorldInfo(name, data) {
|
|||||||
await saveWorldInfo(newName, data, true);
|
await saveWorldInfo(newName, data, true);
|
||||||
await deleteWorldInfo(oldName);
|
await deleteWorldInfo(oldName);
|
||||||
|
|
||||||
const existingCharLores = world_info.charLore.filter((e) => e.extraBooks.includes(oldName));
|
const existingCharLores = world_info.charLore?.filter((e) => e.extraBooks.includes(oldName));
|
||||||
if (existingCharLores && existingCharLores.length > 0) {
|
if (existingCharLores && existingCharLores.length > 0) {
|
||||||
existingCharLores.forEach((charLore) => {
|
existingCharLores.forEach((charLore) => {
|
||||||
const tempCharLore = charLore.extraBooks.filter((e) => e !== oldName);
|
const tempCharLore = charLore.extraBooks.filter((e) => e !== oldName);
|
||||||
@ -747,7 +747,7 @@ async function getCharacterLore() {
|
|||||||
|
|
||||||
// TODO: Maybe make the utility function not use the window context?
|
// TODO: Maybe make the utility function not use the window context?
|
||||||
const fileName = getCharaFilename(this_chid);
|
const fileName = getCharaFilename(this_chid);
|
||||||
const extraCharLore = world_info.charLore.find((e) => e.name === fileName);
|
const extraCharLore = world_info.charLore?.find((e) => e.name === fileName);
|
||||||
if (extraCharLore) {
|
if (extraCharLore) {
|
||||||
worldsToSearch = new Set([...worldsToSearch, ...extraCharLore.extraBooks]);
|
worldsToSearch = new Set([...worldsToSearch, ...extraCharLore.extraBooks]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user