Fix continue token count overflow
This commit is contained in:
parent
a5aadd936c
commit
c6bbbf1c25
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue