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 examplesString = '';
|
||||||
let chatString = '';
|
let chatString = '';
|
||||||
|
let cyclePrompt = '';
|
||||||
|
|
||||||
function getMessagesTokenCount() {
|
function getMessagesTokenCount() {
|
||||||
const encodeString = [
|
const encodeString = [
|
||||||
storyString,
|
storyString,
|
||||||
|
@ -2552,6 +2554,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||||
chatString,
|
chatString,
|
||||||
allAnchors,
|
allAnchors,
|
||||||
quiet_prompt,
|
quiet_prompt,
|
||||||
|
cyclePrompt,
|
||||||
].join('').replace(/\r/gm, '');
|
].join('').replace(/\r/gm, '');
|
||||||
return getTokenCount(encodeString, power_user.token_padding);
|
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('');
|
pinExmString = examplesString = mesExamplesArray.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
let cyclePrompt = '';
|
|
||||||
if (isContinue) {
|
if (isContinue) {
|
||||||
cyclePrompt = chat2.shift();
|
cyclePrompt = chat2.shift();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue