| 5970 | nameToTrim = power_user.allow_name1_display ? '' : name1; | 5970 | nameToTrim = power_user.allow_name1_display ? '' : name1; |
| 5971 | } | 5971 | } |
| 5972 | | 5972 | |
| 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 | } |