Don't trim on whitespace user prefix sequence
| @@ -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 | } |