Don't trim on whitespace user prefix sequence
This commit is contained in:
parent
8cb4aa6a49
commit
dedb96ec8d
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue