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
3760 }3760 }
37613761
3762 let examplesString = '';3762 let examplesString = '';
3763 let chatString = '';3763 let chatString = addChatsPreamble(addChatsSeparator(''));
3764 let cyclePrompt = '';3764 let cyclePrompt = '';
37653765
3766 async function getMessagesTokenCount() {3766 async function getMessagesTokenCount() {
@@ -4028,12 +4028,13 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
4028 async function checkPromptSize() {4028 async function checkPromptSize() {
4029 console.debug('---checking Prompt size');4029 console.debug('---checking Prompt size');
4030 setPromptString();4030 setPromptString();
4031 const jointMessages = mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join('');
4031 const prompt = [4032 const prompt = [
4032 beforeScenarioAnchor,4033 beforeScenarioAnchor,
4033 storyString,4034 storyString,
4034 afterScenarioAnchor,4035 afterScenarioAnchor,
4035 mesExmString,4036 mesExmString,
4036 mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''),4037 addChatsPreamble(addChatsSeparator(jointMessages)),
4037 '\n',4038 '\n',
4038 generatedPromptCache,4039 generatedPromptCache,
4039 quiet_prompt,4040 quiet_prompt,