Add {{newline}} and {{pipe}} macros
This commit is contained in:
parent
86819b6f4f
commit
3594c4aac7
|
@ -2010,6 +2010,7 @@ function substituteParams(content, _name1, _name2, _original, _group, _replaceCh
|
|||
}
|
||||
|
||||
content = replaceVariableMacros(content);
|
||||
content = content.replace(/{{newline}}/gi, "\n");
|
||||
content = content.replace(/{{input}}/gi, String($('#send_textarea').val()));
|
||||
|
||||
if (_replaceCharacterCard) {
|
||||
|
|
|
@ -1014,7 +1014,12 @@ async function executeSlashCommands(text) {
|
|||
}
|
||||
|
||||
console.debug('Slash command executing:', result);
|
||||
const unnamedArg = result.value || pipeResult;
|
||||
let unnamedArg = result.value || pipeResult;
|
||||
|
||||
if (typeof unnamedArg === 'string' && /{{pipe}}/i.test(unnamedArg)) {
|
||||
unnamedArg = unnamedArg.replace(/{{pipe}}/i, pipeResult);
|
||||
}
|
||||
|
||||
pipeResult = await result.command.callback(result.args, unnamedArg);
|
||||
|
||||
if (result.command.interruptsGeneration) {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
System-wide Replacement Macros (in order of evaluation):
|
||||
</div>
|
||||
<ul>
|
||||
<li><tt>{{pipe}}</tt> – only for slash command batching. Replaced with the returned result of the previous command.</li>
|
||||
<li><tt>{{newline}}</tt> – just inserts a newline.</li>
|
||||
<li><tt>{{original}}</tt> – global prompts defined in API settings. Only valid in Advanced Definitions prompt overrides.</li>
|
||||
<li><tt>{{input}}</tt> – the user input</li>
|
||||
<li><tt>{{charPrompt}}</tt> – the Character's Main Prompt override</li>
|
||||
|
|
Loading…
Reference in New Issue