From ccd6a1631a2aa1bb5575af050b13370d5ba239bb Mon Sep 17 00:00:00 2001 From: Reithan Date: Sat, 1 Mar 2025 05:48:11 -0800 Subject: [PATCH 1/2] Account for generated depth on non-continue --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 19ff46cfc..0e433c849 100644 --- a/public/script.js +++ b/public/script.js @@ -3866,7 +3866,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { let message = chatItem.mes; let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; - let options = { isPrompt: true, depth: (coreChat.length - index - 1) }; + let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue?1:0)) }; let regexedMessage = getRegexedString(message, regexType, options); regexedMessage = await appendFileContent(chatItem, regexedMessage); @@ -3884,7 +3884,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro const reasoning = new PromptReasoning(); for (let i = coreChat.length - 1; i >= 0; i--) { - const depth = coreChat.length - i - 1; + const depth = coreChat.length - i - (isContinue?1:0); const isPrefix = isContinue && i === coreChat.length - 1; coreChat[i] = { ...coreChat[i], From 0bedb6e0ff6dc611ef743f0426c381b38c26a5b4 Mon Sep 17 00:00:00 2001 From: Reithan Date: Sat, 1 Mar 2025 05:49:18 -0800 Subject: [PATCH 2/2] Autoformat --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 0e433c849..dca4a5ba1 100644 --- a/public/script.js +++ b/public/script.js @@ -3866,7 +3866,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { let message = chatItem.mes; let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; - let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue?1:0)) }; + let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue ? 1 : 0)) }; let regexedMessage = getRegexedString(message, regexType, options); regexedMessage = await appendFileContent(chatItem, regexedMessage); @@ -3884,7 +3884,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro const reasoning = new PromptReasoning(); for (let i = coreChat.length - 1; i >= 0; i--) { - const depth = coreChat.length - i - (isContinue?1:0); + const depth = coreChat.length - i - (isContinue ? 1 : 0); const isPrefix = isContinue && i === coreChat.length - 1; coreChat[i] = { ...coreChat[i],