diff --git a/public/script.js b/public/script.js index 2e8b8d736..cda7adea3 100644 --- a/public/script.js +++ b/public/script.js @@ -5427,6 +5427,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>')); } const isInstruct = power_user.instruct.enabled && main_api !== 'openai'; + const isNotEmpty = (str) => str && str.trim() !== ''; if (isInstruct && power_user.instruct.stop_sequence) { if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) { getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence)); @@ -5434,7 +5435,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc } // Hana: Only use the first sequence (should be <|model|>) // of the prompt before <|user|> (as KoboldAI Lite does it). - if (isInstruct && power_user.instruct.input_sequence) { + if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) { if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) { getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence)); }