Fix TC sysprompt leaking into CC prompts

This commit is contained in:
Cohee 2024-09-23 16:42:40 +00:00
parent 7dd8229df6
commit 5b4d524bc0
1 changed files with 9 additions and 7 deletions

View File

@ -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 || '',
};