From 5d0a4fa94003a1da0490ccab0fe2793ed29968d3 Mon Sep 17 00:00:00 2001 From: GanstaKingofSA Date: Mon, 4 Sep 2023 16:29:49 -0500 Subject: [PATCH] add input sequence as stop sequence by default --- public/script.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/script.js b/public/script.js index 8d5faf7d7..8d6338048 100644 --- a/public/script.js +++ b/public/script.js @@ -3855,6 +3855,13 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence)); } } + // 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 (getMessage.indexOf(power_user.instruct.input_sequence) != -1) { + getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence)); + } + } if (isInstruct && power_user.instruct.input_sequence && isImpersonate) { //getMessage = getMessage.replaceAll(power_user.instruct.input_sequence, ''); power_user.instruct.input_sequence.split('\n')