From 39ebffa282f78f6c94815ac9b7b95ade2c7aa228 Mon Sep 17 00:00:00 2001 From: qvink Date: Thu, 20 Mar 2025 20:00:26 -0600 Subject: [PATCH 01/10] Fix for removal of "{{user}}:" from generations --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 15ec77c97..22e8287ec 100644 --- a/public/script.js +++ b/public/script.js @@ -5971,10 +5971,10 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc } if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) == 0) { - getMessage = getMessage.substring(0, getMessage.indexOf(`${nameToTrim}:`)); + getMessage = getMessage.substring(getMessage.indexOf(`${nameToTrim}:`)+nameToTrim.length); } if (nameToTrim && getMessage.indexOf(`\n${nameToTrim}:`) >= 0) { - getMessage = getMessage.substring(0, getMessage.indexOf(`\n${nameToTrim}:`)); + getMessage = getMessage.substring(getMessage.indexOf(`\n${nameToTrim}:`)+nameToTrim.length); } if (getMessage.indexOf('<|endoftext|>') != -1) { getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>')); From ff21ee24d1bd66e4cd1f756a6b1357c301e3e3e4 Mon Sep 17 00:00:00 2001 From: qvink Date: Thu, 20 Mar 2025 21:46:16 -0600 Subject: [PATCH 02/10] removing redundant .indexOf(). Adding extra length to account for the colon. --- public/script.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/script.js b/public/script.js index 22e8287ec..60163ddec 100644 --- a/public/script.js +++ b/public/script.js @@ -5970,12 +5970,18 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc nameToTrim = power_user.allow_name1_display ? '' : name1; } - if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) == 0) { - getMessage = getMessage.substring(getMessage.indexOf(`${nameToTrim}:`)+nameToTrim.length); + // get text from after the name (and colon) to the end of the string + if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) === 0) { + getMessage = getMessage.substring(nameToTrim.length+1); } - if (nameToTrim && getMessage.indexOf(`\n${nameToTrim}:`) >= 0) { - getMessage = getMessage.substring(getMessage.indexOf(`\n${nameToTrim}:`)+nameToTrim.length); + + // account for case where the name is after a newline + let startIndex = getMessage.indexOf(`\n${nameToTrim}:`) + if (nameToTrim && startIndex >= 0) { + // get text from after the name (and colon) to the end of the string + getMessage = getMessage.substring(startIndex+nameToTrim.length+2); } + if (getMessage.indexOf('<|endoftext|>') != -1) { getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>')); } From c4175697ef69b673b0d2bb1f2b89592d5e4eda35 Mon Sep 17 00:00:00 2001 From: qvink Date: Fri, 21 Mar 2025 12:18:48 -0600 Subject: [PATCH 03/10] cleanUpMessages() now uses object args. Adding option to trim names. --- public/script.js | 124 +++++++++++++++++++++++++++---------- public/scripts/logprobs.js | 7 ++- 2 files changed, 99 insertions(+), 32 deletions(-) diff --git a/public/script.js b/public/script.js index 60163ddec..e700a5885 100644 --- a/public/script.js +++ b/public/script.js @@ -3315,11 +3315,23 @@ class StreamingProcessor { if (!isImpersonate && !isContinue && Array.isArray(this.swipes) && this.swipes.length > 0) { for (let i = 0; i < this.swipes.length; i++) { - this.swipes[i] = cleanUpMessage(this.swipes[i], false, false, true, this.stoppingStrings); + this.swipes[i] = cleanUpMessage({ + getMessage: this.swipes[i], + isImpersonate: false, + isContinue: false, + displayIncompleteSentences: true, + stoppingStrings: this.stoppingStrings + }); } } - let processedText = cleanUpMessage(text, isImpersonate, isContinue, !isFinal, this.stoppingStrings); + let processedText = cleanUpMessage({ + getMessage: text, + isImpersonate: isImpersonate, + isContinue: isContinue, + displayIncompleteSentences: !isFinal, + stoppingStrings: this.stoppingStrings + }); const charsToBalance = ['*', '"', '```']; for (const char of charsToBalance) { @@ -3643,7 +3655,13 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy } // format result, exclude user prompt bias - const message = cleanUpMessage(extractMessageFromData(data), false, false, true, null, false); + const message = cleanUpMessage({ + getMessage: extractMessageFromData(data), + isImpersonate: false, + isContinue: false, + displayIncompleteSentences: true, + includeUserPromptBias: false + }); if (!message) { throw new Error('No message generated'); @@ -4844,7 +4862,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro hideSwipeButtons(); let getMessage = await streamingProcessor.generate(); - let messageChunk = cleanUpMessage(getMessage, isImpersonate, isContinue, false); + let messageChunk = cleanUpMessage({ + getMessage: getMessage, + isImpersonate: isImpersonate, + isContinue: isContinue, + displayIncompleteSentences: false + }); if (isContinue) { getMessage = continue_mag + getMessage; @@ -4928,7 +4951,14 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro const swipes = extractMultiSwipes(data, type); - messageChunk = cleanUpMessage(getMessage, isImpersonate, isContinue, false); + messageChunk = cleanUpMessage({ + getMessage: getMessage, + isImpersonate: isImpersonate, + isContinue: isContinue, + displayIncompleteSentences: false + }); + + reasoning = getRegexedString(reasoning, regex_placement.REASONING); if (power_user.trim_spaces) { @@ -4942,7 +4972,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro //Formating const displayIncomplete = type === 'quiet' && !quietToLoud; - getMessage = cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete); + getMessage = cleanUpMessage({ + getMessage: getMessage, + isImpersonate: isImpersonate, + isContinue: isContinue, + displayIncompleteSentences: displayIncomplete + }); if (isImpersonate) { $('#send_textarea').val(getMessage)[0].dispatchEvent(new Event('input', { bubbles: true })); @@ -5908,7 +5943,13 @@ function extractMultiSwipes(data, type) { for (let i = 1; i < data.choices.length; i++) { const text = data?.choices[i]?.message?.content ?? data?.choices[i]?.text ?? ''; - const cleanedText = cleanUpMessage(text, false, false, false); + const cleanedText = cleanUpMessage({ + getMessage: text, + isImpersonate: false, + isContinue: false, + displayIncompleteSentences: false + }); + swipes.push(cleanedText); } } @@ -5916,7 +5957,25 @@ function extractMultiSwipes(data, type) { return swipes; } -export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncompleteSentences = false, stoppingStrings = null, includeUserPromptBias = true) { +/** + * Formats a message according to user settings + * @param {object} [options] - Additional options. + * @param {string} [options.getMessage] The message to clean up + * @param {boolean} [options.isImpersonate] Whether this is an impersonated message + * @param {boolean} [options.isContinue] Whether this is a continued message + * @param {boolean} [options.displayIncompleteSentences] Whether to *not* trim incomplete sentences. + * @param {array} [options.stoppingStrings] Array of stopping strings. + * @param {boolean} [options.includeUserPromptBias] Whether to permit prepending the user prompt bias at the beginning. +@param {boolean} [options.trimNames] Whether to allow trimming "{{char}}:" or "{{user}}:" from the beginning. + * + * @returns {string} The formatted message + */ +export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayIncompleteSentences = false, stoppingStrings = null, includeUserPromptBias = true, trimNames = true} = {}) { + if (arguments.length > 0 && typeof arguments[0] !== 'object') { + console.trace('cleanUpMessage called with positional arguments. Please use an object instead.'); + [getMessage, isImpersonate, isContinue, displayIncompleteSentences, stoppingStrings, includeUserPromptBias] = arguments; + } + if (!getMessage) { return ''; } @@ -5961,25 +6020,26 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc // "trailing whitespace on newlines\nevery line of the string\nsample text" getMessage = getMessage.replace(/[^\S\r\n]+$/gm, ''); - let nameToTrim = isImpersonate ? name2 : name1; + // Trim instances of "{{name}}:" from the start of the message+ + if (trimNames) { + let nameToTrim = isImpersonate ? name2 : name1; + if (isImpersonate) { + nameToTrim = power_user.allow_name2_display ? '' : name2; + } else { + nameToTrim = power_user.allow_name1_display ? '' : name1; + } - if (isImpersonate) { - nameToTrim = power_user.allow_name2_display ? '' : name2; - } - else { - nameToTrim = power_user.allow_name1_display ? '' : name1; - } - - // get text from after the name (and colon) to the end of the string - if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) === 0) { - getMessage = getMessage.substring(nameToTrim.length+1); - } - - // account for case where the name is after a newline - let startIndex = getMessage.indexOf(`\n${nameToTrim}:`) - if (nameToTrim && startIndex >= 0) { // get text from after the name (and colon) to the end of the string - getMessage = getMessage.substring(startIndex+nameToTrim.length+2); + if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) === 0) { + getMessage = getMessage.substring(nameToTrim.length + 1); + } + + // account for case where the name is after a newline + let startIndex = getMessage.indexOf(`\n${nameToTrim}:`) + if (nameToTrim && startIndex >= 0) { + getMessage = getMessage.substring(startIndex + nameToTrim.length + 2); + } + getMessage.trimStart(); } if (getMessage.indexOf('<|endoftext|>') != -1) { @@ -6041,13 +6101,15 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc getMessage = fixMarkdown(getMessage, false); } - const nameToTrim2 = isImpersonate - ? (!power_user.allow_name1_display ? name1 : '') - : (!power_user.allow_name2_display ? name2 : ''); + if (trimNames) { + const nameToTrim2 = isImpersonate + ? (!power_user.allow_name1_display ? name1 : '') + : (!power_user.allow_name2_display ? name2 : ''); - if (nameToTrim2 && getMessage.startsWith(nameToTrim2 + ':')) { - getMessage = getMessage.replace(nameToTrim2 + ':', ''); - getMessage = getMessage.trimStart(); + if (nameToTrim2 && getMessage.startsWith(nameToTrim2 + ':')) { + getMessage = getMessage.replace(nameToTrim2 + ':', ''); + getMessage = getMessage.trimStart(); + } } if (isImpersonate) { diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index 0314375c1..b26edd577 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -368,7 +368,12 @@ function onToggleLogprobsPanel() { function createSwipe(messageId, prompt) { // need to call `cleanUpMessage` on our new prompt, because we were working // with raw model output and our new prompt is missing trimming/macro replacements - const cleanedPrompt = cleanUpMessage(prompt, false, false, true); + const cleanedPrompt = cleanUpMessage({ + getMessage: prompt, + isImpersonate: false, + isContinue: false, + displayIncompleteSentences: true + }); const msg = chat[messageId]; const newSwipeInfo = { From f713948a1b44bfe56a37a75adbac4975155db083 Mon Sep 17 00:00:00 2001 From: qvink Date: Fri, 21 Mar 2025 12:32:06 -0600 Subject: [PATCH 04/10] formatting --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index e700a5885..bb5f24b8e 100644 --- a/public/script.js +++ b/public/script.js @@ -5963,10 +5963,10 @@ function extractMultiSwipes(data, type) { * @param {string} [options.getMessage] The message to clean up * @param {boolean} [options.isImpersonate] Whether this is an impersonated message * @param {boolean} [options.isContinue] Whether this is a continued message - * @param {boolean} [options.displayIncompleteSentences] Whether to *not* trim incomplete sentences. + * @param {boolean} [options.displayIncompleteSentences] Whether to keep incomplete sentences at the end. * @param {array} [options.stoppingStrings] Array of stopping strings. * @param {boolean} [options.includeUserPromptBias] Whether to permit prepending the user prompt bias at the beginning. -@param {boolean} [options.trimNames] Whether to allow trimming "{{char}}:" or "{{user}}:" from the beginning. + * @param {boolean} [options.trimNames] Whether to allow trimming "{{char}}:" or "{{user}}:" from the beginning. * * @returns {string} The formatted message */ From 82b885e5ef06b61073b6c4cda073b1bf65f73dfb Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 21 Mar 2025 21:49:26 +0200 Subject: [PATCH 05/10] Sorry we don't know why lint didn't work --- public/script.js | 18 +++++++++--------- public/scripts/logprobs.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/public/script.js b/public/script.js index bb5f24b8e..a4188394f 100644 --- a/public/script.js +++ b/public/script.js @@ -3320,7 +3320,7 @@ class StreamingProcessor { isImpersonate: false, isContinue: false, displayIncompleteSentences: true, - stoppingStrings: this.stoppingStrings + stoppingStrings: this.stoppingStrings, }); } } @@ -3330,7 +3330,7 @@ class StreamingProcessor { isImpersonate: isImpersonate, isContinue: isContinue, displayIncompleteSentences: !isFinal, - stoppingStrings: this.stoppingStrings + stoppingStrings: this.stoppingStrings, }); const charsToBalance = ['*', '"', '```']; @@ -3660,7 +3660,7 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy isImpersonate: false, isContinue: false, displayIncompleteSentences: true, - includeUserPromptBias: false + includeUserPromptBias: false, }); if (!message) { @@ -4866,7 +4866,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro getMessage: getMessage, isImpersonate: isImpersonate, isContinue: isContinue, - displayIncompleteSentences: false + displayIncompleteSentences: false, }); if (isContinue) { @@ -4955,7 +4955,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro getMessage: getMessage, isImpersonate: isImpersonate, isContinue: isContinue, - displayIncompleteSentences: false + displayIncompleteSentences: false, }); @@ -4976,7 +4976,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro getMessage: getMessage, isImpersonate: isImpersonate, isContinue: isContinue, - displayIncompleteSentences: displayIncomplete + displayIncompleteSentences: displayIncomplete, }); if (isImpersonate) { @@ -5947,7 +5947,7 @@ function extractMultiSwipes(data, type) { getMessage: text, isImpersonate: false, isContinue: false, - displayIncompleteSentences: false + displayIncompleteSentences: false, }); swipes.push(cleanedText); @@ -5970,7 +5970,7 @@ function extractMultiSwipes(data, type) { * * @returns {string} The formatted message */ -export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayIncompleteSentences = false, stoppingStrings = null, includeUserPromptBias = true, trimNames = true} = {}) { +export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayIncompleteSentences = false, stoppingStrings = null, includeUserPromptBias = true, trimNames = true } = {}) { if (arguments.length > 0 && typeof arguments[0] !== 'object') { console.trace('cleanUpMessage called with positional arguments. Please use an object instead.'); [getMessage, isImpersonate, isContinue, displayIncompleteSentences, stoppingStrings, includeUserPromptBias] = arguments; @@ -6035,7 +6035,7 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI } // account for case where the name is after a newline - let startIndex = getMessage.indexOf(`\n${nameToTrim}:`) + let startIndex = getMessage.indexOf(`\n${nameToTrim}:`); if (nameToTrim && startIndex >= 0) { getMessage = getMessage.substring(startIndex + nameToTrim.length + 2); } diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index b26edd577..87222cc79 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -372,7 +372,7 @@ function createSwipe(messageId, prompt) { getMessage: prompt, isImpersonate: false, isContinue: false, - displayIncompleteSentences: true + displayIncompleteSentences: true, }); const msg = chat[messageId]; From 841f8141370f474afaa0452fd5b31b408e6fd2af Mon Sep 17 00:00:00 2001 From: qvink Date: Sat, 22 Mar 2025 15:52:37 -0600 Subject: [PATCH 06/10] Reverting cleanUpMessage() functionality changes. --- public/script.js | 57 +++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/public/script.js b/public/script.js index a4188394f..270050745 100644 --- a/public/script.js +++ b/public/script.js @@ -3563,9 +3563,10 @@ class StreamingProcessor { * @param {boolean} quietToLoud true to generate a message in system mode, false to generate a message in character mode * @param {string} [systemPrompt] System prompt to use. Only Instruct mode or OpenAI. * @param {number} [responseLength] Maximum response length. If unset, the global default value is used. + * @param {boolean} [trimNames] Whether to allow trimming "{{user}}:" and "{{char}}:" from the response. * @returns {Promise} Generated message */ -export async function generateRaw(prompt, api, instructOverride, quietToLoud, systemPrompt, responseLength) { +export async function generateRaw(prompt, api, instructOverride, quietToLoud, systemPrompt, responseLength, trimNames = true) { if (!api) { api = main_api; } @@ -3661,6 +3662,8 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy isContinue: false, displayIncompleteSentences: true, includeUserPromptBias: false, + trimNames: trimNames, + trimWrongNames: trimNames, }); if (!message) { @@ -5970,10 +5973,10 @@ function extractMultiSwipes(data, type) { * * @returns {string} The formatted message */ -export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayIncompleteSentences = false, stoppingStrings = null, includeUserPromptBias = true, trimNames = true } = {}) { +export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayIncompleteSentences = false, stoppingStrings = null, includeUserPromptBias = true, trimNames = true, trimWrongNames = true } = {}) { if (arguments.length > 0 && typeof arguments[0] !== 'object') { console.trace('cleanUpMessage called with positional arguments. Please use an object instead.'); - [getMessage, isImpersonate, isContinue, displayIncompleteSentences, stoppingStrings, includeUserPromptBias] = arguments; + [getMessage, isImpersonate, isContinue, displayIncompleteSentences, stoppingStrings, includeUserPromptBias, trimNames, trimWrongNames] = arguments; } if (!getMessage) { @@ -6020,26 +6023,33 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI // "trailing whitespace on newlines\nevery line of the string\nsample text" getMessage = getMessage.replace(/[^\S\r\n]+$/gm, ''); - // Trim instances of "{{name}}:" from the start of the message+ - if (trimNames) { - let nameToTrim = isImpersonate ? name2 : name1; - if (isImpersonate) { - nameToTrim = power_user.allow_name2_display ? '' : name2; - } else { - nameToTrim = power_user.allow_name1_display ? '' : name1; - } + if (trimWrongNames) { + // If this is an impersonation, delete the entire response if it starts with "{{char}}:" + // If this isn't an impersonation, delete the entire response if it starts with "{{user}}:" + // Also delete any trailing text that starts with the wrong name. + // This only occurs if the corresponding "power_user.allow_nameX_display" is false. - // get text from after the name (and colon) to the end of the string - if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) === 0) { - getMessage = getMessage.substring(nameToTrim.length + 1); - } + let wrongName = isImpersonate + ? (power_user.allow_name2_display ? '' : name2) // char + : (power_user.allow_name1_display ? '' : name1); // user - // account for case where the name is after a newline - let startIndex = getMessage.indexOf(`\n${nameToTrim}:`); - if (nameToTrim && startIndex >= 0) { - getMessage = getMessage.substring(startIndex + nameToTrim.length + 2); + if (wrongName) { + // If the message starts with the wrong name, delete the entire response + let startIndex = getMessage.indexOf(`${wrongName}`); + if (startIndex === 0) { + getMessage = ''; + console.debug(`Message started with the wrong name: "${wrongName}" - response was deleted.`); + } + + // If there is trailing text starting with the wrong name, trim it off. + startIndex = getMessage.indexOf(`\n${wrongName}:`); + if (startIndex >= 0) { + getMessage = getMessage.substring(0, startIndex); + } + + // remove any whitespace at the beginning + getMessage = getMessage.trimStart(); } - getMessage.trimStart(); } if (getMessage.indexOf('<|endoftext|>') != -1) { @@ -6102,9 +6112,12 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI } if (trimNames) { + // If this is an impersonation, trim "{{user}}:" from the beginning + // If this isn't an impersonation, trim "{{char}}:" from the beginning. + // Only applied when the corresponding "power_user.allow_nameX_display" is false. const nameToTrim2 = isImpersonate - ? (!power_user.allow_name1_display ? name1 : '') - : (!power_user.allow_name2_display ? name2 : ''); + ? (!power_user.allow_name1_display ? name1 : '') // user + : (!power_user.allow_name2_display ? name2 : ''); // char if (nameToTrim2 && getMessage.startsWith(nameToTrim2 + ':')) { getMessage = getMessage.replace(nameToTrim2 + ':', ''); From 9a3e3433c70172df30ed432b3407e808175e8a10 Mon Sep 17 00:00:00 2001 From: qvink Date: Sat, 22 Mar 2025 15:54:57 -0600 Subject: [PATCH 07/10] Adding missing doc string --- public/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/script.js b/public/script.js index 270050745..80113ebf6 100644 --- a/public/script.js +++ b/public/script.js @@ -5970,6 +5970,7 @@ function extractMultiSwipes(data, type) { * @param {array} [options.stoppingStrings] Array of stopping strings. * @param {boolean} [options.includeUserPromptBias] Whether to permit prepending the user prompt bias at the beginning. * @param {boolean} [options.trimNames] Whether to allow trimming "{{char}}:" or "{{user}}:" from the beginning. + * @param {boolean} [options.trimWrongNames] Whether to allow deleting responses prefixed by the incorrect name, depending on isImpersonate * * @returns {string} The formatted message */ From 900575ee1ad11a489463cfed29b12c70fbf09c04 Mon Sep 17 00:00:00 2001 From: qvink Date: Sat, 22 Mar 2025 16:30:54 -0600 Subject: [PATCH 08/10] adding missing colon --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 80113ebf6..9e5cec987 100644 --- a/public/script.js +++ b/public/script.js @@ -6036,7 +6036,7 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI if (wrongName) { // If the message starts with the wrong name, delete the entire response - let startIndex = getMessage.indexOf(`${wrongName}`); + let startIndex = getMessage.indexOf(`${wrongName}:`); if (startIndex === 0) { getMessage = ''; console.debug(`Message started with the wrong name: "${wrongName}" - response was deleted.`); From 36adb6992ef18e57d548b18cdbdf26090821d6e9 Mon Sep 17 00:00:00 2001 From: qvink Date: Sat, 22 Mar 2025 16:43:08 -0600 Subject: [PATCH 09/10] the cooler ternary --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 9e5cec987..7267d0296 100644 --- a/public/script.js +++ b/public/script.js @@ -6031,8 +6031,8 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI // This only occurs if the corresponding "power_user.allow_nameX_display" is false. let wrongName = isImpersonate - ? (power_user.allow_name2_display ? '' : name2) // char - : (power_user.allow_name1_display ? '' : name1); // user + ? (!power_user.allow_name2_display ? name2 : '') // char + : (!power_user.allow_name1_display ? name1 : ''); // user if (wrongName) { // If the message starts with the wrong name, delete the entire response From 66832fc98aa599fd00870e01347eed39e2d90d78 Mon Sep 17 00:00:00 2001 From: qvink Date: Sun, 23 Mar 2025 09:41:03 -0600 Subject: [PATCH 10/10] removing whitespace trimming in trimWrongNames block --- public/script.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/public/script.js b/public/script.js index 7267d0296..001cc72fc 100644 --- a/public/script.js +++ b/public/script.js @@ -6047,9 +6047,6 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI if (startIndex >= 0) { getMessage = getMessage.substring(0, startIndex); } - - // remove any whitespace at the beginning - getMessage = getMessage.trimStart(); } }