Add char.card Jailbreak support for Text Completion APIs
This commit is contained in:
parent
5efdecc825
commit
7ad2473f99
|
@ -2665,6 +2665,10 @@
|
|||
<input id="context_use_stop_strings" type="checkbox" />
|
||||
<small data-i18n="Use as Stop Strings">Use as Stop Strings</small>
|
||||
</label>
|
||||
<label class="checkbox_label" title="Includes Jailbreak at the end of the prompt, if defined in the character card AND ''Prefer Char. Jailbreak'' is enabled. THIS IS NOT RECOMMENDED FOR TEXT COMPLETION MODELS, CAN LEAD TO BAD OUTPUT.">
|
||||
<input id="context_allow_jailbreak" type="checkbox" />
|
||||
<small data-i18n="Allow Jailbreak">Allow Jailbreak</small>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div data-newbie-hidden class="inline-drawer wide100p flexFlowColumn margin-bot-10px" style="display:none;">
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -217,6 +217,7 @@ let power_user = {
|
|||
chat_start: defaultChatStart,
|
||||
example_separator: defaultExampleSeparator,
|
||||
use_stop_strings: true,
|
||||
allow_jailbreak: false,
|
||||
},
|
||||
|
||||
personas: {},
|
||||
|
@ -294,6 +295,7 @@ const contextControls = [
|
|||
{ id: 'context_example_separator', property: 'example_separator', isCheckbox: false, isGlobalSetting: false },
|
||||
{ id: 'context_chat_start', property: 'chat_start', isCheckbox: false, isGlobalSetting: false },
|
||||
{ id: 'context_use_stop_strings', property: 'use_stop_strings', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
||||
{ id: 'context_allow_jailbreak', property: 'allow_jailbreak', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
||||
|
||||
// Existing power user settings
|
||||
{ id: 'always-force-name2-checkbox', property: 'always_force_name2', isCheckbox: true, isGlobalSetting: true, defaultValue: true },
|
||||
|
|
Loading…
Reference in New Issue