Add a main {{systemPrompt}} macro
This commit is contained in:
parent
63117653bb
commit
845409a239
|
@ -518,13 +518,15 @@ function selectMatchingContextTemplate(name) {
|
||||||
/**
|
/**
|
||||||
* Replaces instruct mode macros in the given input string.
|
* Replaces instruct mode macros in the given input string.
|
||||||
* @param {string} input Input string.
|
* @param {string} input Input string.
|
||||||
|
* @param {Object<string, *>} env - Map of macro names to the values they'll be substituted with. If the param
|
||||||
* @returns {string} String with macros replaced.
|
* @returns {string} String with macros replaced.
|
||||||
*/
|
*/
|
||||||
export function replaceInstructMacros(input) {
|
export function replaceInstructMacros(input, env) {
|
||||||
if (!input) {
|
if (!input) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const instructMacros = {
|
const instructMacros = {
|
||||||
|
'systemPrompt': (power_user.prefer_character_prompt && env.charPrompt ? env.charPrompt : power_user.instruct.system_prompt),
|
||||||
'instructSystem|instructSystemPrompt': power_user.instruct.system_prompt,
|
'instructSystem|instructSystemPrompt': power_user.instruct.system_prompt,
|
||||||
'instructSystemPromptPrefix': power_user.instruct.system_sequence_prefix,
|
'instructSystemPromptPrefix': power_user.instruct.system_sequence_prefix,
|
||||||
'instructSystemPromptSuffix': power_user.instruct.system_sequence_suffix,
|
'instructSystemPromptSuffix': power_user.instruct.system_sequence_suffix,
|
||||||
|
|
|
@ -257,7 +257,7 @@ export function evaluateMacros(content, env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
content = diceRollReplace(content);
|
content = diceRollReplace(content);
|
||||||
content = replaceInstructMacros(content);
|
content = replaceInstructMacros(content, env);
|
||||||
content = replaceVariableMacros(content);
|
content = replaceVariableMacros(content);
|
||||||
content = content.replace(/{{newline}}/gi, '\n');
|
content = content.replace(/{{newline}}/gi, '\n');
|
||||||
content = content.replace(/\n*{{trim}}\n*/gi, '');
|
content = content.replace(/\n*{{trim}}\n*/gi, '');
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<li><tt>{{maxPrompt}}</tt> – max allowed prompt length in tokens = (context size - response length)</li>
|
<li><tt>{{maxPrompt}}</tt> – max allowed prompt length in tokens = (context size - response length)</li>
|
||||||
<li><tt>{{exampleSeparator}}</tt> – context template example dialogues separator</li>
|
<li><tt>{{exampleSeparator}}</tt> – context template example dialogues separator</li>
|
||||||
<li><tt>{{chatStart}}</tt> – context template chat start line</li>
|
<li><tt>{{chatStart}}</tt> – context template chat start line</li>
|
||||||
|
<li><tt>{{systemPrompt}}</tt> – main system prompt (either character prompt override if chosen, or instructSystemPrompt)</li>
|
||||||
<li><tt>{{instructSystemPrompt}}</tt> – instruct system prompt</li>
|
<li><tt>{{instructSystemPrompt}}</tt> – instruct system prompt</li>
|
||||||
<li><tt>{{instructSystemPromptPrefix}}</tt> – instruct system prompt prefix sequence</li>
|
<li><tt>{{instructSystemPromptPrefix}}</tt> – instruct system prompt prefix sequence</li>
|
||||||
<li><tt>{{instructSystemPromptSuffix}}</tt> – instruct system prompt suffix sequence</li>
|
<li><tt>{{instructSystemPromptSuffix}}</tt> – instruct system prompt suffix sequence</li>
|
||||||
|
|
Loading…
Reference in New Issue