Spec v2: {{original}} macro for prompt overrides.

This commit is contained in:
Cohee
2023-06-22 23:24:22 +03:00
parent c096a55697
commit 1672824416
4 changed files with 15 additions and 6 deletions

View File

@@ -1377,13 +1377,20 @@ function scrollChatToBottom() {
}
}
function substituteParams(content, _name1, _name2) {
function substituteParams(content, _name1, _name2, _original) {
_name1 = _name1 ?? name1;
_name2 = _name2 ?? name2;
if (!content) {
return ''
}
// Replace {{original}} with the original message
// Note: only replace the first instance of {{original}}
// This will hopefully prevent the abuse
if (_original) {
content = content.replace(/{{original}}/i, _original);
}
content = content.replace(/{{user}}/gi, _name1);
content = content.replace(/{{char}}/gi, _name2);
content = content.replace(/<USER>/gi, _name1);