mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-01-31 11:35:37 +01:00
Change macro substitution order
This commit is contained in:
parent
71f47588cd
commit
4bd7364a8e
@ -2163,10 +2163,6 @@ function scrollChatToBottom() {
|
||||
function substituteParams(content, _name1, _name2, _original, _group, _replaceCharacterCard = true) {
|
||||
const environment = {};
|
||||
|
||||
environment.user = _name1 ?? name1;
|
||||
environment.char = _name2 ?? name2;
|
||||
environment.group = environment.charIfNotGroup = _group ?? name2;
|
||||
|
||||
let substitutedOriginal = false;
|
||||
environment.original = () => {
|
||||
// Only substitute {{original}} on its first occurrence
|
||||
@ -2185,6 +2181,12 @@ function substituteParams(content, _name1, _name2, _original, _group, _replaceCh
|
||||
environment.mesExamples = fields.mesExamples || '';
|
||||
}
|
||||
|
||||
// Must be substituted last so that they're replaced inside {{description}}
|
||||
// TODO: evaluate macros recursively so we don't need to rely on substitution order
|
||||
environment.user = _name1 ?? name1;
|
||||
environment.char = _name2 ?? name2;
|
||||
environment.group = environment.charIfNotGroup = _group ?? name2;
|
||||
|
||||
return evaluateMacros(content, environment);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user