mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-22 23:18:27 +01:00
Add {{groupNotMuted}}
This commit is contained in:
parent
f5f60e269e
commit
3502bfcaa0
@ -2607,15 +2607,18 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const getGroupValue = () => {
|
const getGroupValue = (includeMuted) => {
|
||||||
if (typeof _group === 'string') {
|
if (typeof _group === 'string') {
|
||||||
return _group;
|
return _group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_group) {
|
if (selected_group) {
|
||||||
const members = groups.find(x => x.id === selected_group)?.members;
|
const members = groups.find(x => x.id === selected_group)?.members;
|
||||||
|
/** @type {string[]} */
|
||||||
|
const disabledMembers = groups.find(x => x.id === selected_group)?.disabled_members ?? [];
|
||||||
|
const isMuted = x => includeMuted ? true : !disabledMembers.includes(x);
|
||||||
const names = Array.isArray(members)
|
const names = Array.isArray(members)
|
||||||
? members.map(m => characters.find(c => c.avatar === m)?.name).filter(Boolean).join(', ')
|
? members.filter(isMuted).map(m => characters.find(c => c.avatar === m)?.name).filter(Boolean).join(', ')
|
||||||
: '';
|
: '';
|
||||||
return names;
|
return names;
|
||||||
} else {
|
} else {
|
||||||
@ -2639,7 +2642,8 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
|||||||
// Must be substituted last so that they're replaced inside {{description}}
|
// Must be substituted last so that they're replaced inside {{description}}
|
||||||
environment.user = _name1 ?? name1;
|
environment.user = _name1 ?? name1;
|
||||||
environment.char = _name2 ?? name2;
|
environment.char = _name2 ?? name2;
|
||||||
environment.group = environment.charIfNotGroup = getGroupValue();
|
environment.group = environment.charIfNotGroup = getGroupValue(true);
|
||||||
|
environment.groupNotMuted = getGroupValue(false);
|
||||||
environment.model = getGeneratingModel();
|
environment.model = getGeneratingModel();
|
||||||
|
|
||||||
if (additionalMacro && typeof additionalMacro === 'object') {
|
if (additionalMacro && typeof additionalMacro === 'object') {
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
<li><tt>{{user}}</tt> – <span data-i18n="help_macros_15">your current Persona username</span></li>
|
<li><tt>{{user}}</tt> – <span data-i18n="help_macros_15">your current Persona username</span></li>
|
||||||
<li><tt>{{char}}</tt> – <span data-i18n="help_macros_16">the Character's name</span></li>
|
<li><tt>{{char}}</tt> – <span data-i18n="help_macros_16">the Character's name</span></li>
|
||||||
<li><tt>{{char_version}}</tt> – <span data-i18n="help_macros_17">the Character's version number</span></li>
|
<li><tt>{{char_version}}</tt> – <span data-i18n="help_macros_17">the Character's version number</span></li>
|
||||||
<li><tt>{{group}}</tt> – <span data-i18n="help_macros_18">a comma-separated list of group member names or the character name in solo chats. Alias: {{charIfNotGroup}}</span></li>
|
<li><tt>{{group}}</tt> – <span data-i18n="help_macros_18">a comma-separated list of group member names (including muted) or the character name in solo chats. Alias: {{charIfNotGroup}}</span></li>
|
||||||
|
<li><tt>{{groupNotMuted}}</tt> – <span data-i18n="help_groupNotMuted">the same as {{group}}, but excludes muted members</span></li>
|
||||||
<li><tt>{{model}}</tt> – <span data-i18n="help_macros_19">a text generation model name for the currently selected API. </span><b data-i18n="Can be inaccurate!">Can be inaccurate!</b></li>
|
<li><tt>{{model}}</tt> – <span data-i18n="help_macros_19">a text generation model name for the currently selected API. </span><b data-i18n="Can be inaccurate!">Can be inaccurate!</b></li>
|
||||||
<li><tt>{{lastMessage}}</tt> – <span data-i18n="help_macros_20">the text of the latest chat message.</span></li>
|
<li><tt>{{lastMessage}}</tt> – <span data-i18n="help_macros_20">the text of the latest chat message.</span></li>
|
||||||
<li><tt>{{lastUserMessage}}</tt> – <span data-i18n="help_macros_lastUser">the text of the latest user chat message.</span></li>
|
<li><tt>{{lastUserMessage}}</tt> – <span data-i18n="help_macros_lastUser">the text of the latest user chat message.</span></li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user