Merge pull request #3591 from SillyTavern/revert-3587-fix-miscounted-messages-on-generate-and-swipe Revert "Account for generated depth on non-continue"
Signed| @@ -3866,7 +3866,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 3866 | coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { | 3866 | coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { |
| 3867 | let message = chatItem.mes; | 3867 | let message = chatItem.mes; |
| 3868 | let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; | 3868 | let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; |
| 3869 | let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue ? 1 : 0)) }; | 3869 | let options = { isPrompt: true, depth: (coreChat.length - index - 1) }; |
| 3870 | 3870 | ||
| 3871 | let regexedMessage = getRegexedString(message, regexType, options); | 3871 | let regexedMessage = getRegexedString(message, regexType, options); |
| 3872 | regexedMessage = await appendFileContent(chatItem, regexedMessage); | 3872 | regexedMessage = await appendFileContent(chatItem, regexedMessage); |
| @@ -3884,7 +3884,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 3884 | 3884 | ||
| 3885 | const reasoning = new PromptReasoning(); | 3885 | const reasoning = new PromptReasoning(); |
| 3886 | for (let i = coreChat.length - 1; i >= 0; i--) { | 3886 | for (let i = coreChat.length - 1; i >= 0; i--) { |
| 3887 | const depth = coreChat.length - i - (isContinue ? 1 : 0); | 3887 | const depth = coreChat.length - i - 1; |
| 3888 | const isPrefix = isContinue && i === coreChat.length - 1; | 3888 | const isPrefix = isContinue && i === coreChat.length - 1; |
| 3889 | coreChat[i] = { | 3889 | coreChat[i] = { |
| 3890 | ...coreChat[i], | 3890 | ...coreChat[i], |