diff --git a/public/script.js b/public/script.js index b24b411f2..68798deec 100644 --- a/public/script.js +++ b/public/script.js @@ -3769,10 +3769,10 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro storyString, afterScenarioAnchor, examplesString, - chatString, - quiet_prompt, - cyclePrompt, userAlignmentMessage, + chatString, + modifyLastPromptLine(''), + cyclePrompt, ].join('').replace(/\r/gm, ''); return getTokenCountAsync(encodeString, power_user.token_padding); } @@ -3803,8 +3803,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro } tokenCount += await getTokenCountAsync(item.replace(/\r/gm, '')); - chatString = item + chatString; if (tokenCount < this_max_context) { + chatString = chatString + item; arrMes[index] = item; lastAddedIndex = Math.max(lastAddedIndex, index); } else { @@ -3830,8 +3830,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro } tokenCount += await getTokenCountAsync(item.replace(/\r/gm, '')); - chatString = item + chatString; if (tokenCount < this_max_context) { + chatString = chatString + item; arrMes[i] = item; lastAddedIndex = Math.max(lastAddedIndex, i); } else { @@ -4036,8 +4036,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro mesExmString, addChatsPreamble(addChatsSeparator(jointMessages)), '\n', + modifyLastPromptLine(''), generatedPromptCache, - quiet_prompt, ].join('').replace(/\r/gm, ''); let thisPromptContextSize = await getTokenCountAsync(prompt, power_user.token_padding);