Remove the /inject when value is empty

This commit is contained in:
Cohee
2024-04-27 20:25:55 +03:00
parent 5dcfda0514
commit 053d7f9eaa

View File

@ -146,7 +146,7 @@ class SlashCommandParser {
return { return {
commandName: command, commandName: command,
command: { command: {
callback: () => {}, callback: () => { },
helpString: '', helpString: '',
interruptsGeneration: false, interruptsGeneration: false,
purgeFromMessage: true, purgeFromMessage: true,
@ -338,13 +338,12 @@ function injectCallback(args, value) {
chat_metadata.script_injects = {}; chat_metadata.script_injects = {};
} }
chat_metadata.script_injects[id] = { if (value) {
value, const inject = { value, position, depth, scan, role };
position, chat_metadata.script_injects[id] = inject;
depth, } else {
scan, delete chat_metadata.script_injects[id];
role, }
};
setExtensionPrompt(prefixedId, value, position, depth, scan, role); setExtensionPrompt(prefixedId, value, position, depth, scan, role);
saveMetadataDebounced(); saveMetadataDebounced();