From fa06e5ee5adaddb960c863a53e4994a37eef7e11 Mon Sep 17 00:00:00 2001 From: city-unit <140349364+city-unit@users.noreply.github.com> Date: Sat, 29 Jul 2023 22:15:54 -0400 Subject: [PATCH 1/4] Add optional alerting for WI debugging. --- public/index.html | 8 ++++++++ public/script.js | 2 ++ public/scripts/world-info.js | 14 ++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/public/index.html b/public/index.html index f175bae71..b56802560 100644 --- a/public/index.html +++ b/public/index.html @@ -2145,6 +2145,14 @@ Match whole words + diff --git a/public/script.js b/public/script.js index 5edba339e..e5a76344b 100644 --- a/public/script.js +++ b/public/script.js @@ -26,6 +26,7 @@ import { getWorldInfoPrompt, setWorldInfoSettings, world_info_recursive, + world_info_overflow_alert, world_info_case_sensitive, world_info_match_whole_words, world_names, @@ -5077,6 +5078,7 @@ async function saveSettings(type) { world_info_depth: world_info_depth, world_info_budget: world_info_budget, world_info_recursive: world_info_recursive, + world_info_overflow_alert: world_info_overflow_alert, world_info_case_sensitive: world_info_case_sensitive, world_info_match_whole_words: world_info_match_whole_words, world_info_character_strategy: world_info_character_strategy, diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 0e4480023..1e41b51b7 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -10,6 +10,7 @@ export { world_info_budget, world_info_depth, world_info_recursive, + world_info_overflow_alert, world_info_case_sensitive, world_info_match_whole_words, world_info_character_strategy, @@ -32,6 +33,7 @@ let world_names; let world_info_depth = 2; let world_info_budget = 25; let world_info_recursive = false; +let world_info_overflow_alert = false; let world_info_case_sensitive = false; let world_info_match_whole_words = false; let world_info_character_strategy = world_info_insertion_strategy.character_first; @@ -70,6 +72,8 @@ function setWorldInfoSettings(settings, data) { world_info_budget = Number(settings.world_info_budget); if (settings.world_info_recursive !== undefined) world_info_recursive = Boolean(settings.world_info_recursive); + if (settings.world_info_overflow_alert !== undefined) + world_info_overflow_alert = Boolean(settings.world_info_overflow_alert); if (settings.world_info_case_sensitive !== undefined) world_info_case_sensitive = Boolean(settings.world_info_case_sensitive); if (settings.world_info_match_whole_words !== undefined) @@ -102,6 +106,7 @@ function setWorldInfoSettings(settings, data) { $("#world_info_budget").val(world_info_budget); $("#world_info_recursive").prop('checked', world_info_recursive); + $("#world_info_overflow_alert").prop('checked', world_info_overflow_alert); $("#world_info_case_sensitive").prop('checked', world_info_case_sensitive); $("#world_info_match_whole_words").prop('checked', world_info_match_whole_words); @@ -1020,6 +1025,10 @@ async function checkWorldInfo(chat, maxContext) { if (textToScanTokens + getTokenCount(newContent) >= budget) { console.debug(`WI budget reached, stopping`); + if (world_info_overflow_alert) { + console.log("Alerting"); + toastr.warning(`World info budget reached after ${count} entries.`, 'World Info'); + } needsToScan = false; break; } @@ -1501,6 +1510,11 @@ jQuery(() => { saveSettingsDebounced(); }); + $('#world_info_overflow_alert').on('change', function () { + world_info_overflow_alert = $(this).val(); + saveSettingsDebounced(); + }); + $('#world_button').on('click', async function () { const chid = $('#set_character_world').data('chid'); From 0aee97ccca4756a39d7f77656259612ff94483f7 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 30 Jul 2023 11:47:17 +0900 Subject: [PATCH 2/4] Added Option to toggle/Hide settings bar. --- public/index.html | 4 ++++ public/script.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/public/index.html b/public/index.html index d35758337..bd03bf63f 100644 --- a/public/index.html +++ b/public/index.html @@ -3751,6 +3751,10 @@ Regenerate + + + Settings + diff --git a/public/script.js b/public/script.js index 3162a67fd..086725ca1 100644 --- a/public/script.js +++ b/public/script.js @@ -7715,6 +7715,22 @@ $(document).ready(function () { else if (id == "option_delete_mes") { setTimeout(openMessageDelete, animation_duration); } + + else if (id == "option_settings") { + //var checkBox = document.getElementById("waifuMode"); + var topBar = document.getElementById("top-bar"); + var topSettingsHolder = document.getElementById("top-settings-holder"); + + //if (checkBox.checked) { + if (topBar.style.display === "none") { + topBar.style.display = ""; // or "inline-block" if that's the original display value + topSettingsHolder.style.display = ""; // or "inline-block" if that's the original display value + } else { + topBar.style.display = "none"; + topSettingsHolder.style.display = "none"; + } + //} + } hideMenu(); }); From 11226ff7d6fccad1c70b99e34a51a7949adebda7 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 30 Jul 2023 11:56:17 +0900 Subject: [PATCH 3/4] add CSS to round corners --- public/script.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/public/script.js b/public/script.js index 0dc49a8dd..273a56734 100644 --- a/public/script.js +++ b/public/script.js @@ -7750,20 +7750,30 @@ $(document).ready(function () { setTimeout(openMessageDelete, animation_duration); } - else if (id == "option_settings") { + else if (id === "option_settings") { //var checkBox = document.getElementById("waifuMode"); var topBar = document.getElementById("top-bar"); var topSettingsHolder = document.getElementById("top-settings-holder"); - + var divchat = document.getElementById("chat"); + //if (checkBox.checked) { if (topBar.style.display === "none") { - topBar.style.display = ""; // or "inline-block" if that's the original display value - topSettingsHolder.style.display = ""; // or "inline-block" if that's the original display value + topBar.style.display = ""; // or "inline-block" if that's the original display value + topSettingsHolder.style.display = ""; // or "inline-block" if that's the original display value + + divchat.style.borderRadius = ""; + divchat.style.backgroundColor = ""; + divchat.style.padding = ""; } else { - topBar.style.display = "none"; - topSettingsHolder.style.display = "none"; + + divchat.style.borderRadius = "10px"; // Adjust the value to control the roundness of the corners + divchat.style.backgroundColor = "#f0f0f0"; // Set the background color to your preference + divchat.style.padding = "10px"; // Add some padding to give it some space inside + + topBar.style.display = "none"; + topSettingsHolder.style.display = "none"; } - //} + //} } hideMenu(); }); From d8d51182838380e229990d16ff02f989837995c0 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 30 Jul 2023 11:57:21 +0900 Subject: [PATCH 4/4] removed padding --- public/script.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 273a56734..098b41a9d 100644 --- a/public/script.js +++ b/public/script.js @@ -7763,12 +7763,11 @@ $(document).ready(function () { divchat.style.borderRadius = ""; divchat.style.backgroundColor = ""; - divchat.style.padding = ""; + } else { divchat.style.borderRadius = "10px"; // Adjust the value to control the roundness of the corners divchat.style.backgroundColor = "#f0f0f0"; // Set the background color to your preference - divchat.style.padding = "10px"; // Add some padding to give it some space inside topBar.style.display = "none"; topSettingsHolder.style.display = "none";