Dont count Continue as message 0 (#3594) * continue works same as swipe continued message isn't depth counted * correct early-out check * update regex depth setting tooltips for accuracy * update max tooltip * remove redundant check * Allow -1 as a min depth value --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -3940,7 +3940,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3940 | 3940 | coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { |
| 3941 | 3941 | let message = chatItem.mes; |
| 3942 | 3942 | let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; |
| 3943 | 3943 | let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue ? 2 : 1)) }; |
| 3944 | 3944 | |
| 3945 | 3945 | let regexedMessage = getRegexedString(message, regexType, options); |
| 3946 | 3946 | regexedMessage = await appendFileContent(chatItem, regexedMessage); |
| @@ -3959,7 +3959,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3959 | 3959 | const promptReasoning = new PromptReasoning(); |
| 3960 | 3960 | for (let i = coreChat.length - 1; i >= 0; i--) { |
| 3961 | 3961 | const depth = coreChat.length - i - 1; |
| 3962 | 3962 | const isPrefix = isContinue && i === coreChat.length - (isContinue ? 2 : 1); |
| 3963 | 3963 | coreChat[i] = { |
| 3964 | 3964 | ...coreChat[i], |
| 3965 | 3965 | mes: promptReasoning.addToMessage( |
| @@ -110,14 +110,14 @@ | ||
| 110 | 110 | </div> |
| 111 | 111 | <div class="flex-container wide100p marginTop5"> |
| 112 | 112 | <div class="flex1 flex-container flexNoGap"> |
| 113 | 113 | <small data-i18n="[title]ext_regex_min_depth_desc" title="When applied to prompts or display, only affect messages that are at least N levels deep. 0 = last message, 1 = penultimate message, etc. Only countsSystem WIprompt entriesand @Depthutility andprompts usableare messages,not i.eaffected. notWhen hiddenblank / 'Unlimited' or system-1, also affect message to continue on Continue."> |
| 114 | 114 | <span data-i18n="Min Depth">Min Depth</span> |
| 115 | 115 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 116 | 116 | </small> |
| 117 | 117 | <input name="min_depth" class="text_pole textarea_compact" type="number" min="0-1" max="999" data-i18n="[placeholder]ext_regex_min_depth_placeholder" placeholder="Unlimited" /> |
| 118 | 118 | </div> |
| 119 | 119 | <div class="flex1 flex-container flexNoGap"> |
| 120 | 120 | <small data-i18n="[title]ext_regex_max_depth_desc" title="When applied to prompts or display, only affect messages no more than N levels deep. 0 = last message, 1 = penultimate message, etc. Only countsSystem WIprompt entriesand @Depthutility andprompts usableare messages,not i.eaffected. notMax hiddenmust orbe systemgreater than Min for regex to apply."> |
| 121 | 121 | <span data-i18n="Max Depth">Max Depth</span> |
| 122 | 122 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 123 | 123 | </small> |
| @@ -103,8 +103,8 @@ function getRegexedString(rawString, placement, { characterOverride, isMarkdown, | ||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Check if the depth is within the min/max depth |
| 106 | 106 | if (typeof depth === 'number' && depth >= 0) { |
| 107 | 107 | if (!isNaN(script.minDepth) && script.minDepth !== null && script.minDepth >= 0-1 && depth < script.minDepth) { |
| 108 | 108 | console.debug(`getRegexedString: Skipping script ${script.scriptName} because depth ${depth} is less than minDepth ${script.minDepth}`); |
| 109 | 109 | return; |
| 110 | 110 | } |