From eaadb1c5c266a9b01e95edd6a2649a00411ed5fd Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 16 Oct 2023 23:13:32 +0300 Subject: [PATCH] Prevent double insert of chat lore --- public/scripts/world-info.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 4ee3f8958..8a43c5687 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -1281,6 +1281,11 @@ async function getCharacterLore() { continue; } + if (chat_metadata[METADATA_KEY] === worldName) { + console.debug(`Character ${name}'s world ${worldName} is already activated in chat lore! Skipping...`); + continue; + } + const data = await loadWorldInfoData(worldName); const newEntries = data ? Object.keys(data.entries).map((x) => data.entries[x]) : []; entries = entries.concat(newEntries); @@ -1314,6 +1319,11 @@ async function getChatLore() { return []; } + if (selected_world_info.includes(chatWorld)) { + console.debug(`Chat world ${chatWorld} is already activated in global world info! Skipping...`); + return []; + } + const data = await loadWorldInfoData(chatWorld); const entries = data ? Object.keys(data.entries).map((x) => data.entries[x]) : [];