Add char.card Jailbreak support for Text Completion APIs

This commit is contained in:
Cohee
2024-03-12 23:22:29 +02:00
parent 5efdecc825
commit 7ad2473f99
3 changed files with 13 additions and 0 deletions

View File

@ -3182,6 +3182,13 @@ 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)
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 });
}
let chat2 = [];
let continue_mag = '';
for (let i = coreChat.length - 1, j = 0; i >= 0; i--, j++) {