Don't trim on whitespace user prefix sequence

dedb96ec8d6f99c1ff8742ca4ae039e43b913926

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -1Showing whitespace changes
public/script.js+2 -1
@@ -5427,6 +5427,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
5427 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));5427 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
5428 }5428 }
5429 const isInstruct = power_user.instruct.enabled && main_api !== 'openai';5429 const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
5430 const isNotEmpty = (str) => str && str.trim() !== '';
5430 if (isInstruct && power_user.instruct.stop_sequence) {5431 if (isInstruct && power_user.instruct.stop_sequence) {
5431 if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {5432 if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
5432 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));5433 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
@@ -5434,7 +5435,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
5434 }5435 }
5435 // Hana: Only use the first sequence (should be <|model|>)5436 // Hana: Only use the first sequence (should be <|model|>)
5436 // of the prompt before <|user|> (as KoboldAI Lite does it).5437 // of the prompt before <|user|> (as KoboldAI Lite does it).
5437 if (isInstruct && power_user.instruct.input_sequence) {5438 if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) {
5438 if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {5439 if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {
5439 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));5440 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
5440 }5441 }