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 examplesString = '';
|
||||||
let chatString = '';
|
let chatString = addChatsPreamble(addChatsSeparator(''));
|
||||||
let cyclePrompt = '';
|
let cyclePrompt = '';
|
||||||
|
|
||||||
async function getMessagesTokenCount() {
|
async function getMessagesTokenCount() {
|
||||||
@@ -4028,12 +4028,13 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
async function checkPromptSize() {
|
async function checkPromptSize() {
|
||||||
console.debug('---checking Prompt size');
|
console.debug('---checking Prompt size');
|
||||||
setPromptString();
|
setPromptString();
|
||||||
|
const jointMessages = mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join('');
|
||||||
const prompt = [
|
const prompt = [
|
||||||
beforeScenarioAnchor,
|
beforeScenarioAnchor,
|
||||||
storyString,
|
storyString,
|
||||||
afterScenarioAnchor,
|
afterScenarioAnchor,
|
||||||
mesExmString,
|
mesExmString,
|
||||||
mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''),
|
addChatsPreamble(addChatsSeparator(jointMessages)),
|
||||||
'\n',
|
'\n',
|
||||||
generatedPromptCache,
|
generatedPromptCache,
|
||||||
quiet_prompt,
|
quiet_prompt,
|
||||||
|
Reference in New Issue
Block a user