Merge pull request #776 from bdashore3/staging

This commit is contained in:
Cohee
2023-07-25 09:34:13 +03:00
committed by GitHub
2 changed files with 11 additions and 12 deletions

View File

@ -2958,7 +2958,7 @@ function getNextMessageId(type) {
} }
export function getBiasStrings(textareaText, type) { export function getBiasStrings(textareaText, type) {
if (type == 'impersonate') { if (type == 'impersonate' || type == 'continue') {
return { messageBias: '', promptBias: '', isUserPromptBias: false }; return { messageBias: '', promptBias: '', isUserPromptBias: false };
} }

View File

@ -5,13 +5,14 @@ import { regex_placement } from "./engine.js";
async function saveRegexScript(regexScript, existingScriptIndex) { async function saveRegexScript(regexScript, existingScriptIndex) {
// If not editing // If not editing
if (existingScriptIndex === -1) {
// Is the script name undefined?
if (!regexScript.scriptName) {
toastr.error(`Could not save regex script: The script name was undefined or empty!`);
return;
}
// Is the script name undefined or empty?
if (!regexScript.scriptName) {
toastr.error(`Could not save regex script: The script name was undefined or empty!`);
return;
}
if (existingScriptIndex === -1) {
// Does the script name already exist? // Does the script name already exist?
if (extension_settings.regex.find((e) => e.scriptName === regexScript.scriptName)) { if (extension_settings.regex.find((e) => e.scriptName === regexScript.scriptName)) {
toastr.error(`Could not save regex script: A script with name ${regexScript.scriptName} already exists.`); toastr.error(`Could not save regex script: A script with name ${regexScript.scriptName} already exists.`);
@ -29,14 +30,12 @@ async function saveRegexScript(regexScript, existingScriptIndex) {
// Is a find regex present? // Is a find regex present?
if (regexScript.findRegex.length === 0) { if (regexScript.findRegex.length === 0) {
toastr.error(`Could not save regex script: A find regex is required!`); toastr.warning(`This regex script will not work, but was saved anyway: A find regex isn't present.`);
return;
} }
// Is there someplace to place results? // Is there someplace to place results?
if (regexScript.placement.length === 0) { if (regexScript.placement.length === 0) {
toastr.error(`Could not save regex script: One placement checkbox must be selected!`); toastr.warning(`This regex script will not work, but was saved anyway: One "Affects" checkbox must be selected!`);
return;
} }
if (existingScriptIndex !== -1) { if (existingScriptIndex !== -1) {
@ -140,7 +139,7 @@ async function onRegexEditorOpenClick(existingId) {
.prop("checked", true); .prop("checked", true);
editorHtml editorHtml
.find(`input[name="replace_position"][value="0"]`) .find(`input[name="replace_position"][value="1"]`)
.prop("checked", true); .prop("checked", true);
} }