From 31beb05aa1714e95a32b0a3eab00c8baf42f42b9 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 9 Sep 2023 18:19:01 +0300 Subject: [PATCH 1/3] Substitute macro in Novel preamble --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 7a23fc25a..73442f5f8 100644 --- a/public/script.js +++ b/public/script.js @@ -3416,7 +3416,7 @@ function parseTokenCounts(counts, thisPromptBits) { function addChatsPreamble(mesSendString) { return main_api === 'novel' - ? nai_settings.preamble + '\n' + mesSendString + ? substituteParams(nai_settings.preamble) + '\n' + mesSendString : mesSendString; } From f92249790f86cde976cb5dba9f08f87c572c66b1 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 10 Sep 2023 00:58:37 +0300 Subject: [PATCH 2/3] The return of permanent tokens display --- public/index.html | 21 ++++++++++++++------- public/scripts/RossAscends-mods.js | 5 +++++ public/style.css | 11 +++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/public/index.html b/public/index.html index 890be2906..2ca5ebac5 100644 --- a/public/index.html +++ b/public/index.html @@ -3233,9 +3233,16 @@

diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 0bbd92665..758abcaeb 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -210,10 +210,12 @@ $("#character_popup").on("input", function () { countTokensDebounced(); }); //function: export function RA_CountCharTokens() { let total_tokens = 0; + let permanent_tokens = 0; $('[data-token-counter]').each(function () { const counter = $(this); const input = $(document.getElementById(counter.data('token-counter'))); + const isPermanent = counter.data('token-permanent') === true; const value = String(input.val()); if (input.length === 0) { @@ -230,10 +232,12 @@ export function RA_CountCharTokens() { if (input.data('last-value-hash') === valueHash) { total_tokens += Number(counter.text()); + permanent_tokens += isPermanent ? Number(counter.text()) : 0; } else { const tokens = getTokenCount(value); counter.text(tokens); total_tokens += tokens; + permanent_tokens += isPermanent ? tokens : 0; input.data('last-value-hash', valueHash); } }); @@ -242,6 +246,7 @@ export function RA_CountCharTokens() { const tokenLimit = Math.max(((main_api !== 'openai' ? max_context : oai_settings.openai_max_context) / 2), 1024); const showWarning = (total_tokens > tokenLimit); $('#result_info_total_tokens').text(total_tokens); + $('#result_info_permanent_tokens').text(permanent_tokens); $('#result_info_text').toggleClass('neutral_warning', showWarning); $('#chartokenwarning').toggle(showWarning); } diff --git a/public/style.css b/public/style.css index ef21e17c7..daa55b596 100644 --- a/public/style.css +++ b/public/style.css @@ -1172,7 +1172,7 @@ input[type="file"] { #rm_ch_create_block { display: none; overflow-y: auto; - padding: 0 5px; + padding: 5px; height: 100%; } @@ -1767,10 +1767,17 @@ grammarly-extension { #result_info { font-size: calc(var(--mainFontSize) * 0.9); display: flex; - align-items: baseline; + align-items: center; gap: 10px; } +#result_info_text { + display: flex; + flex-direction: column; + line-height: 1; + text-align: right; +} + .rm_stats_button { cursor: pointer; } From 3dbdd1258e095121f102b3a667f02b5e3c671eaf Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 10 Sep 2023 02:30:23 +0300 Subject: [PATCH 3/3] Don't close the panels when dismissing toasts --- public/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/script.js b/public/script.js index 73442f5f8..ecc170884 100644 --- a/public/script.js +++ b/public/script.js @@ -8468,6 +8468,7 @@ jQuery(async function () { '#world_popup', '.ui-widget', '.text_pole', + '#toast-container', ]; for (const id of forbiddenTargets) { if (clickTarget.closest(id).length > 0) {