From c6bbbf1c25f8bf51373f63930e9e47db7010edd6 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 31 Aug 2023 00:16:58 +0300 Subject: [PATCH] Fix continue token count overflow --- public/script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 5ef41fc2a..cfc24f8a4 100644 --- a/public/script.js +++ b/public/script.js @@ -2545,6 +2545,8 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, let examplesString = ''; let chatString = ''; + let cyclePrompt = ''; + function getMessagesTokenCount() { const encodeString = [ storyString, @@ -2552,6 +2554,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, chatString, allAnchors, quiet_prompt, + cyclePrompt, ].join('').replace(/\r/gm, ''); return getTokenCount(encodeString, power_user.token_padding); } @@ -2562,7 +2565,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, pinExmString = examplesString = mesExamplesArray.join(''); } - let cyclePrompt = ''; if (isContinue) { cyclePrompt = chat2.shift(); }