diff --git a/public/scripts/instruct-mode.js b/public/scripts/instruct-mode.js index 3167f3bb5..d6a8039b4 100644 --- a/public/scripts/instruct-mode.js +++ b/public/scripts/instruct-mode.js @@ -518,13 +518,15 @@ function selectMatchingContextTemplate(name) { /** * Replaces instruct mode macros in the given input string. * @param {string} input Input string. + * @param {Object} env - Map of macro names to the values they'll be substituted with. If the param * @returns {string} String with macros replaced. */ -export function replaceInstructMacros(input) { +export function replaceInstructMacros(input, env) { if (!input) { return ''; } const instructMacros = { + 'systemPrompt': (power_user.prefer_character_prompt && env.charPrompt ? env.charPrompt : power_user.instruct.system_prompt), 'instructSystem|instructSystemPrompt': power_user.instruct.system_prompt, 'instructSystemPromptPrefix': power_user.instruct.system_sequence_prefix, 'instructSystemPromptSuffix': power_user.instruct.system_sequence_suffix, diff --git a/public/scripts/macros.js b/public/scripts/macros.js index a9df01987..70d4d9bb3 100644 --- a/public/scripts/macros.js +++ b/public/scripts/macros.js @@ -257,7 +257,7 @@ export function evaluateMacros(content, env) { } content = diceRollReplace(content); - content = replaceInstructMacros(content); + content = replaceInstructMacros(content, env); content = replaceVariableMacros(content); content = content.replace(/{{newline}}/gi, '\n'); content = content.replace(/\n*{{trim}}\n*/gi, ''); diff --git a/public/scripts/templates/macros.html b/public/scripts/templates/macros.html index f3291333f..2eb9ca7b7 100644 --- a/public/scripts/templates/macros.html +++ b/public/scripts/templates/macros.html @@ -49,6 +49,7 @@
  • {{maxPrompt}} – max allowed prompt length in tokens = (context size - response length)
  • {{exampleSeparator}} – context template example dialogues separator
  • {{chatStart}} – context template chat start line
  • +
  • {{systemPrompt}} – main system prompt (either character prompt override if chosen, or instructSystemPrompt)
  • {{instructSystemPrompt}} – instruct system prompt
  • {{instructSystemPromptPrefix}} – instruct system prompt prefix sequence
  • {{instructSystemPromptSuffix}} – instruct system prompt suffix sequence