Fix not counting chat separator and preamble toward token limit

b21ba850c0e4837a652770c36d83525c05dd1121

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -2Ignore whitespace
public/script.js+3 -2
@@ -3760,7 +3760,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
37603760 }
37613761
37623762 let examplesString = '';
37633763 let chatString = addChatsPreamble(addChatsSeparator(''));
37643764 let cyclePrompt = '';
37653765
37663766 async function getMessagesTokenCount() {
@@ -4028,12 +4028,13 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
40284028 async function checkPromptSize() {
40294029 console.debug('---checking Prompt size');
40304030 setPromptString();
4031+ const jointMessages = mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join('');
40314032 const prompt = [
40324033 beforeScenarioAnchor,
40334034 storyString,
40344035 afterScenarioAnchor,
40354036 mesExmString,
4036- mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''),
4037+ addChatsPreamble(addChatsSeparator(jointMessages)),
40374038 '\n',
40384039 generatedPromptCache,
40394040 quiet_prompt,