Fix Continue operation when jailbreak enabled.
When character jailbreak prompt is enabled for the text generation API, the jailbreak prompt was always inserted as the last message in history, so the Continue operation was completing the jailbreak prompt instead of the character's last output.
This commit is contained in:
parent
b3aee73ac5
commit
be74f0a6d1
|
@ -3182,11 +3182,18 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
|||
|
||||
//////////////////////////////////
|
||||
|
||||
// Insert character jailbreak as a last user message (if exists, allowed, preferred, and not using Chat Completion)
|
||||
// Insert character jailbreak as the last user message (if exists, allowed, preferred, and not using Chat Completion)
|
||||
if (power_user.context.allow_jailbreak && power_user.prefer_character_jailbreak && main_api !== 'openai' && jailbreak) {
|
||||
// Set "original" explicity to empty string since there's no original
|
||||
jailbreak = substituteParams(jailbreak, name1, name2, '');
|
||||
coreChat.push({ mes: jailbreak, is_user: true });
|
||||
|
||||
// When continuing generation of previous output, last user message precedes the message to continue
|
||||
if (isContinue) {
|
||||
coreChat.splice(coreChat.length - 1, 0, { mes: jailbreak, is_user: true });
|
||||
}
|
||||
else {
|
||||
coreChat.push({ mes: jailbreak, is_user: true });
|
||||
}
|
||||
}
|
||||
|
||||
let chat2 = [];
|
||||
|
|
Loading…
Reference in New Issue