From a6a7810be2cb3bb7db4dca5a16fdac65e518e97d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 29 Jan 2025 11:39:32 +0200 Subject: [PATCH] Regex: fix "Alter Outgoing Prompt" applying when unchecked (#3380) * Regex: rework ephemerality options. * Fix ephemeral regex being executed when unwanted * Revert to old code style --- public/scripts/extensions/regex/engine.js | 2 +- public/scripts/extensions/regex/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/regex/engine.js b/public/scripts/extensions/regex/engine.js index 08de07d6a..f6e22d249 100644 --- a/public/scripts/extensions/regex/engine.js +++ b/public/scripts/extensions/regex/engine.js @@ -95,7 +95,7 @@ function getRegexedString(rawString, placement, { characterOverride, isMarkdown, // Script applies to Generate and input is Generate (script.promptOnly && isPrompt) || // Script applies to all cases when neither "only"s are true, but there's no need to do it when `isMarkdown`, the as source (chat history) should already be changed beforehand - (!script.markdownOnly && !script.promptOnly && !isMarkdown) + (!script.markdownOnly && !script.promptOnly && !isMarkdown && !isPrompt) ) { if (isEdit && !script.runOnEdit) { console.debug(`getRegexedString: Skipping script ${script.scriptName} because it does not run on edit`); diff --git a/public/scripts/extensions/regex/index.js b/public/scripts/extensions/regex/index.js index 73538e4ed..8ac6ae6d6 100644 --- a/public/scripts/extensions/regex/index.js +++ b/public/scripts/extensions/regex/index.js @@ -18,7 +18,7 @@ import { t } from '../../i18n.js'; * @property {string} replaceString - The replace string * @property {string[]} trimStrings - The trim strings * @property {string?} findRegex - The find regex - * @property {string?} substituteRegex - The substitute regex + * @property {number?} substituteRegex - The substitute regex */ /**