Decouple system prompts from instruct mode

This commit is contained in:
Cohee
2024-09-17 10:37:36 +00:00
parent 0b0bd27321
commit b377a2b7d3
51 changed files with 324 additions and 183 deletions

View File

@ -3515,9 +3515,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
jailbreak,
} = getCharacterCardFields();
if (isInstruct) {
system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.instruct.system_prompt, name1, name2);
system = formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.instruct.system_prompt));
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;
}
// Depth prompt (character-specific A/N)
@ -4344,7 +4344,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: isInstruct ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.instruct.system_prompt) : '',
instruction: 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 || '',
};