From 5b4d524bc07486f4c4578c302f7816361b77569b Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:42:40 +0000 Subject: [PATCH] Fix TC sysprompt leaking into CC prompts --- public/script.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/public/script.js b/public/script.js index c8eb8ffda..12bdca049 100644 --- a/public/script.js +++ b/public/script.js @@ -3527,12 +3527,14 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro jailbreak, } = getCharacterCardFields(); - if (power_user.sysprompt.enabled) { - system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.sysprompt.content, name1, name2); - system = isInstruct ? formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.sysprompt.content)) : system; - } else { - // Nullify if it's not enabled - system = ''; + if (main_api !== 'openai') { + if (power_user.sysprompt.enabled) { + system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.sysprompt.content, name1, name2); + system = isInstruct ? formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.sysprompt.content)) : system; + } else { + // Nullify if it's not enabled + system = ''; + } } // Depth prompt (character-specific A/N) @@ -4359,7 +4361,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro this_max_context: this_max_context, padding: power_user.token_padding, main_api: main_api, - instruction: power_user.sysprompt.enabled ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.sysprompt.content) : '', + instruction: main_api !== 'openai' && power_user.sysprompt.enabled ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.sysprompt.content) : '', userPersona: (power_user.persona_description_position == persona_description_positions.IN_PROMPT ? (persona || '') : ''), tokenizer: getFriendlyTokenizerName(main_api).tokenizerName || '', };