mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-13 18:40:11 +01:00
Remove /flushinject's variable usage in unnamed
This commit is contained in:
parent
11ca0dd22e
commit
b97dceeb7a
@ -1310,12 +1310,9 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
description: 'injection ID or a variable name pointing to ID',
|
||||
typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.VARIABLE_NAME],
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
defaultValue: '',
|
||||
enumProvider: () => [
|
||||
...commonEnumProviders.injects(),
|
||||
...commonEnumProviders.variables('all')().map(x => { x.description = 'Variable'; return x; }),
|
||||
],
|
||||
enumProvider: commonEnumProviders.injects,
|
||||
}),
|
||||
],
|
||||
callback: flushInjectsCallback,
|
||||
@ -1486,16 +1483,16 @@ function listInjectsCallback() {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @returns {string} Empty string
|
||||
*/
|
||||
function flushInjectsCallback(args, value) {
|
||||
function flushInjectsCallback(_, value) {
|
||||
if (!chat_metadata.script_injects) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const idArgument = resolveVariable(value, args._scope);
|
||||
const idArgument = value;
|
||||
|
||||
for (const [id, inject] of Object.entries(chat_metadata.script_injects)) {
|
||||
if (idArgument && id !== idArgument) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user