mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix not counting chat separator and preamble toward token limit
This commit is contained in:
@@ -3760,7 +3760,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
}
|
||||
|
||||
let examplesString = '';
|
||||
let chatString = '';
|
||||
let chatString = addChatsPreamble(addChatsSeparator(''));
|
||||
let cyclePrompt = '';
|
||||
|
||||
async function getMessagesTokenCount() {
|
||||
@@ -4028,12 +4028,13 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
async function checkPromptSize() {
|
||||
console.debug('---checking Prompt size');
|
||||
setPromptString();
|
||||
const jointMessages = mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join('');
|
||||
const prompt = [
|
||||
beforeScenarioAnchor,
|
||||
storyString,
|
||||
afterScenarioAnchor,
|
||||
mesExmString,
|
||||
mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''),
|
||||
addChatsPreamble(addChatsSeparator(jointMessages)),
|
||||
'\n',
|
||||
generatedPromptCache,
|
||||
quiet_prompt,
|
||||
|
Reference in New Issue
Block a user