mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Remove /flushinject's variable usage in unnamed
This commit is contained in:
@ -1310,12 +1310,9 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandArgument.fromProps({
|
SlashCommandArgument.fromProps({
|
||||||
description: 'injection ID or a variable name pointing to ID',
|
description: 'injection ID or a variable name pointing to ID',
|
||||||
typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.VARIABLE_NAME],
|
typeList: [ARGUMENT_TYPE.STRING],
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
enumProvider: () => [
|
enumProvider: commonEnumProviders.injects,
|
||||||
...commonEnumProviders.injects(),
|
|
||||||
...commonEnumProviders.variables('all')().map(x => { x.description = 'Variable'; return x; }),
|
|
||||||
],
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
callback: flushInjectsCallback,
|
callback: flushInjectsCallback,
|
||||||
@ -1486,16 +1483,16 @@ function listInjectsCallback() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Flushes script injections for the current chat.
|
* Flushes script injections for the current chat.
|
||||||
* @param {import('./slash-commands/SlashCommand.js').NamedArguments} args Named arguments
|
* @param {import('./slash-commands/SlashCommand.js').NamedArguments} _ Named arguments
|
||||||
* @param {string} value Unnamed argument
|
* @param {string} value Unnamed argument
|
||||||
* @returns {string} Empty string
|
* @returns {string} Empty string
|
||||||
*/
|
*/
|
||||||
function flushInjectsCallback(args, value) {
|
function flushInjectsCallback(_, value) {
|
||||||
if (!chat_metadata.script_injects) {
|
if (!chat_metadata.script_injects) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const idArgument = resolveVariable(value, args._scope);
|
const idArgument = value;
|
||||||
|
|
||||||
for (const [id, inject] of Object.entries(chat_metadata.script_injects)) {
|
for (const [id, inject] of Object.entries(chat_metadata.script_injects)) {
|
||||||
if (idArgument && id !== idArgument) {
|
if (idArgument && id !== idArgument) {
|
||||||
|
Reference in New Issue
Block a user