removing redundant .indexOf(). Adding extra length to account for the colon.

ff21ee24d1bd66e4cd1f756a6b1357c301e3e3e4

qvink <qvink@users.noreply.github.com>

1 files changed, +10 -4Ignore whitespace
public/script.js+10 -4
@@ -5970,12 +5970,18 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
5970 nameToTrim = power_user.allow_name1_display ? '' : name1;5970 nameToTrim = power_user.allow_name1_display ? '' : name1;
5971 }5971 }
59725972
5973 if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) == 0) {5973 // get text from after the name (and colon) to the end of the string
5974 getMessage = getMessage.substring(getMessage.indexOf(`${nameToTrim}:`)+nameToTrim.length);5974 if (nameToTrim && getMessage.indexOf(`${nameToTrim}:`) === 0) {
5975 getMessage = getMessage.substring(nameToTrim.length+1);
5975 }5976 }
5976 if (nameToTrim && getMessage.indexOf(`\n${nameToTrim}:`) >= 0) {5977
5977 getMessage = getMessage.substring(getMessage.indexOf(`\n${nameToTrim}:`)+nameToTrim.length);5978 // account for case where the name is after a newline
5979 let startIndex = getMessage.indexOf(`\n${nameToTrim}:`)
5980 if (nameToTrim && startIndex >= 0) {
5981 // get text from after the name (and colon) to the end of the string
5982 getMessage = getMessage.substring(startIndex+nameToTrim.length+2);
5978 }5983 }
5984
5979 if (getMessage.indexOf('<|endoftext|>') != -1) {5985 if (getMessage.indexOf('<|endoftext|>') != -1) {
5980 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));5986 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
5981 }5987 }