diff --git a/public/script.js b/public/script.js
index 8c9f10c6c..4534e12d6 100644
--- a/public/script.js
+++ b/public/script.js
@@ -159,7 +159,7 @@ import {
import { debounce_timeout } from './scripts/constants.js';
import { ModuleWorkerWrapper, doDailyExtensionUpdatesCheck, extension_settings, getContext, loadExtensionSettings, renderExtensionTemplate, renderExtensionTemplateAsync, runGenerationInterceptors, saveMetadataDebounced, writeExtensionField } from './scripts/extensions.js';
-import { COMMENT_NAME_DEFAULT, executeSlashCommands, executeSlashCommandsOnChatInput, getSlashCommandsHelp, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, registerSlashCommand, stopScriptExecution } from './scripts/slash-commands.js';
+import { COMMENT_NAME_DEFAULT, executeSlashCommands, executeSlashCommandsOnChatInput, getSlashCommandsHelp, initDefaultSlashCommands, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, registerSlashCommand, stopScriptExecution } from './scripts/slash-commands.js';
import {
tag_map,
tags,
@@ -911,6 +911,7 @@ async function firstLoadInit() {
initKeyboard();
initDynamicStyles();
initTags();
+ initDefaultSlashCommands();
await getUserAvatars(true, user_avatar);
await getCharacters();
await getBackgrounds();
diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js
index c595175d2..3573453bd 100644
--- a/public/scripts/slash-commands.js
+++ b/public/scripts/slash-commands.js
@@ -38,13 +38,13 @@ import {
system_message_types,
this_chid,
} from '../script.js';
-import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js';
+import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
import { SlashCommandParserError } from './slash-commands/SlashCommandParserError.js';
import { getMessageTimeStamp } from './RossAscends-mods.js';
import { hideChatMessageRange } from './chats.js';
-import { extension_settings, getContext, saveMetadataDebounced } from './extensions.js';
+import { getContext, saveMetadataDebounced } from './extensions.js';
import { getRegexedString, regex_placement } from './extensions/regex/engine.js';
-import { findGroupMemberId, getGroupMembers, groups, is_group_generating, openGroupById, resetSelectedGroup, saveGroupChat, selected_group } from './group-chats.js';
+import { findGroupMemberId, groups, is_group_generating, openGroupById, resetSelectedGroup, saveGroupChat, selected_group } from './group-chats.js';
import { chat_completion_sources, oai_settings, setupChatCompletionPromptManager } from './openai.js';
import { autoSelectPersona, retriggerFirstMessageOnEmptyChat, setPersonaLockState, togglePersonaLock, user_avatar } from './personas.js';
import { addEphemeralStoppingString, chat_styles, flushEphemeralStoppingStrings, power_user } from './power-user.js';
@@ -53,7 +53,6 @@ import { decodeTextTokens, getFriendlyTokenizerName, getTextTokens, getTokenCoun
import { debounce, delay, isFalseBoolean, isTrueBoolean, stringToRange, trimToEndSentence, trimToStartSentence, waitUntilCondition } from './utils.js';
import { registerVariableCommands, resolveVariable } from './variables.js';
import { background_settings } from './backgrounds.js';
-import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';
import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
@@ -75,78 +74,79 @@ export const parser = new SlashCommandParser();
const registerSlashCommand = SlashCommandParser.addCommand.bind(SlashCommandParser);
const getSlashCommandsHelp = parser.getHelpString.bind(parser);
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: '?',
- callback: helpCommandCallback,
- aliases: ['help'],
- unnamedArgumentList: [SlashCommandArgument.fromProps({
- description: 'help topic',
- typeList: [ARGUMENT_TYPE.STRING],
- enumList: [
- new SlashCommandEnumValue('slash', 'slash commands (STscript)', enumTypes.command, '/'),
- new SlashCommandEnumValue('macros', '{{macros}} (text replacement)', enumTypes.macro, enumIcons.macro),
- new SlashCommandEnumValue('format', 'chat/text formatting', enumTypes.name, '★'),
- new SlashCommandEnumValue('hotkeys', 'keyboard shortcuts', enumTypes.enum, '⏎'),
+export function initDefaultSlashCommands() {
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: '?',
+ callback: helpCommandCallback,
+ aliases: ['help'],
+ unnamedArgumentList: [SlashCommandArgument.fromProps({
+ description: 'help topic',
+ typeList: [ARGUMENT_TYPE.STRING],
+ enumList: [
+ new SlashCommandEnumValue('slash', 'slash commands (STscript)', enumTypes.command, '/'),
+ new SlashCommandEnumValue('macros', '{{macros}} (text replacement)', enumTypes.macro, enumIcons.macro),
+ new SlashCommandEnumValue('format', 'chat/text formatting', enumTypes.name, '★'),
+ new SlashCommandEnumValue('hotkeys', 'keyboard shortcuts', enumTypes.enum, '⏎'),
+ ],
+ })],
+ helpString: 'Get help on macros, chat formatting and commands.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'persona',
+ callback: setNameCallback,
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'mode', 'The mode for persona selection. ("lookup" = search for existing persona, "temp" = create a temporary name, set a temporary name, "all" = allow both in the same command)',
+ [ARGUMENT_TYPE.STRING], false, false, 'all', ['lookup', 'temp', 'all'],
+ ),
],
- })],
- helpString: 'Get help on macros, chat formatting and commands.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'persona',
- callback: setNameCallback,
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'mode', 'The mode for persona selection. ("lookup" = search for existing persona, "temp" = create a temporary name, set a temporary name, "all" = allow both in the same command)',
- [ARGUMENT_TYPE.STRING], false, false, 'all', ['lookup', 'temp', 'all'],
- ),
- ],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'persona name',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.personas,
- }),
- ],
- helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.',
- aliases: ['name'],
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'sync',
- callback: syncCallback,
- helpString: 'Syncs the user persona in user-attributed messages in the current chat.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'lock',
- callback: lockPersonaCallback,
- aliases: ['bind'],
- helpString: 'Locks/unlocks a persona (name and avatar) to the current chat',
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'state',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- defaultValue: 'toggle',
- enumProvider: commonEnumProviders.boolean('onOffToggle'),
- }),
- ],
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'bg',
- callback: setBackgroundCallback,
- aliases: ['background'],
- returns: 'the current background',
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'filename',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: () => [...document.querySelectorAll('.bg_example')]
- .map(it => new SlashCommandEnumValue(it.getAttribute('bgfile')))
- .filter(it => it.value?.length),
- }),
- ],
- helpString: `
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'persona name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.personas,
+ }),
+ ],
+ helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.',
+ aliases: ['name'],
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'sync',
+ callback: syncCallback,
+ helpString: 'Syncs the user persona in user-attributed messages in the current chat.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'lock',
+ callback: lockPersonaCallback,
+ aliases: ['bind'],
+ helpString: 'Locks/unlocks a persona (name and avatar) to the current chat',
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'state',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ defaultValue: 'toggle',
+ enumProvider: commonEnumProviders.boolean('onOffToggle'),
+ }),
+ ],
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'bg',
+ callback: setBackgroundCallback,
+ aliases: ['background'],
+ returns: 'the current background',
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'filename',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: () => [...document.querySelectorAll('.bg_example')]
+ .map(it => new SlashCommandEnumValue(it.getAttribute('bgfile')))
+ .filter(it => it.value?.length),
+ }),
+ ],
+ helpString: `
Sets a background according to the provided filename. Partial names allowed.
@@ -159,35 +159,35 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'sendas',
- callback: sendMessageAs,
- namedArgumentList: [
- SlashCommandNamedArgument.fromProps({
- name: 'name',
- description: 'Character name',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.characters('character'),
- forceEnum: false,
- }),
- new SlashCommandNamedArgument(
- 'compact', 'Use compact layout', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'at',
- description: 'position to insert the message',
- typeList: [ARGUMENT_TYPE.NUMBER],
- enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'sendas',
+ callback: sendMessageAs,
+ namedArgumentList: [
+ SlashCommandNamedArgument.fromProps({
+ name: 'name',
+ description: 'Character name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.characters('character'),
+ forceEnum: false,
+ }),
+ new SlashCommandNamedArgument(
+ 'compact', 'Use compact layout', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'at',
+ description: 'position to insert the message',
+ typeList: [ARGUMENT_TYPE.NUMBER],
+ enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Sends a message as a specific character. Uses the character avatar if it exists in the characters list.
@@ -204,33 +204,33 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
If "compact" is set to true, the message is sent using a compact layout.
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'sys',
- callback: sendNarratorMessage,
- aliases: ['nar'],
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'compact',
- 'compact layout',
- [ARGUMENT_TYPE.BOOLEAN],
- false,
- false,
- 'false',
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'at',
- description: 'position to insert the message',
- typeList: [ARGUMENT_TYPE.NUMBER],
- enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'sys',
+ callback: sendNarratorMessage,
+ aliases: ['nar'],
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'compact',
+ 'compact layout',
+ [ARGUMENT_TYPE.BOOLEAN],
+ false,
+ false,
+ 'false',
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'at',
+ description: 'position to insert the message',
+ typeList: [ARGUMENT_TYPE.NUMBER],
+ enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Sends a message as a system narrator.
@@ -249,44 +249,44 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'sysname',
- callback: setNarratorName,
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'name', [ARGUMENT_TYPE.STRING], false,
- ),
- ],
- helpString: 'Sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'comment',
- callback: sendCommentMessage,
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'compact',
- 'Whether to use a compact layout',
- [ARGUMENT_TYPE.BOOLEAN],
- false,
- false,
- 'false',
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'at',
- description: 'position to insert the message',
- typeList: [ARGUMENT_TYPE.NUMBER],
- enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text',
- [ARGUMENT_TYPE.STRING],
- true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'sysname',
+ callback: setNarratorName,
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'name', [ARGUMENT_TYPE.STRING], false,
+ ),
+ ],
+ helpString: 'Sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'comment',
+ callback: sendCommentMessage,
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'compact',
+ 'Whether to use a compact layout',
+ [ARGUMENT_TYPE.BOOLEAN],
+ false,
+ false,
+ 'false',
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'at',
+ description: 'position to insert the message',
+ typeList: [ARGUMENT_TYPE.NUMBER],
+ enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text',
+ [ARGUMENT_TYPE.STRING],
+ true,
+ ),
+ ],
+ helpString: `
Adds a note/comment message not part of the chat.
@@ -305,35 +305,35 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'single',
- callback: setStoryModeCallback,
- aliases: ['story'],
- helpString: 'Sets the message style to single document mode without names or avatars visible.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'bubble',
- callback: setBubbleModeCallback,
- aliases: ['bubbles'],
- helpString: 'Sets the message style to bubble chat mode.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'flat',
- callback: setFlatModeCallback,
- aliases: ['default'],
- helpString: 'Sets the message style to flat chat mode.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'continue',
- callback: continueChatCallback,
- aliases: ['cont'],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'prompt', [ARGUMENT_TYPE.STRING], false,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'single',
+ callback: setStoryModeCallback,
+ aliases: ['story'],
+ helpString: 'Sets the message style to single document mode without names or avatars visible.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'bubble',
+ callback: setBubbleModeCallback,
+ aliases: ['bubbles'],
+ helpString: 'Sets the message style to bubble chat mode.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'flat',
+ callback: setFlatModeCallback,
+ aliases: ['default'],
+ helpString: 'Sets the message style to flat chat mode.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'continue',
+ callback: continueChatCallback,
+ aliases: ['cont'],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'prompt', [ARGUMENT_TYPE.STRING], false,
+ ),
+ ],
+ helpString: `
Continues the last message in the chat, with an optional additional prompt.
@@ -351,87 +351,87 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'go',
- callback: goToCharacterCallback,
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'name',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.characters('all'),
- }),
- ],
- helpString: 'Opens up a chat with the character or group by its name',
- aliases: ['char'],
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'rename-char',
- /** @param {{silent: string, chats: string}} options @param {string} name */
- callback: async ({ silent = 'true', chats = null }, name) => {
- const renamed = await renameCharacter(name, { silent: isTrueBoolean(silent), renameChats: chats !== null ? isTrueBoolean(chats) : null });
- return String(renamed);
- },
- returns: 'true/false - Whether the rename was successful',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'silent', 'Hide any blocking popups. (if false, the name is optional. If not supplied, a popup asking for it will appear)', [ARGUMENT_TYPE.BOOLEAN], false, false, 'true',
- ),
- new SlashCommandNamedArgument(
- 'chats', 'Rename char in all previous chats', [ARGUMENT_TYPE.BOOLEAN], false, false, '',
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'new char name', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: 'Renames the current character.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'sysgen',
- callback: generateSystemMessage,
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'prompt', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: 'Generates a system message using a specified prompt.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'ask',
- callback: askCharacter,
- namedArgumentList: [
- SlashCommandNamedArgument.fromProps({
- name: 'name',
- description: 'character name',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.characters('character'),
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'prompt', [ARGUMENT_TYPE.STRING], true, false,
- ),
- ],
- helpString: 'Asks a specified character card a prompt. Character name must be provided in a named argument.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'delname',
- callback: deleteMessagesByNameCallback,
- namedArgumentList: [],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'name',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.characters('character'),
- }),
- ],
- aliases: ['cancel'],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'go',
+ callback: goToCharacterCallback,
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.characters('all'),
+ }),
+ ],
+ helpString: 'Opens up a chat with the character or group by its name',
+ aliases: ['char'],
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'rename-char',
+ /** @param {{silent: string, chats: string}} options @param {string} name */
+ callback: async ({ silent = 'true', chats = null }, name) => {
+ const renamed = await renameCharacter(name, { silent: isTrueBoolean(silent), renameChats: chats !== null ? isTrueBoolean(chats) : null });
+ return String(renamed);
+ },
+ returns: 'true/false - Whether the rename was successful',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'silent', 'Hide any blocking popups. (if false, the name is optional. If not supplied, a popup asking for it will appear)', [ARGUMENT_TYPE.BOOLEAN], false, false, 'true',
+ ),
+ new SlashCommandNamedArgument(
+ 'chats', 'Rename char in all previous chats', [ARGUMENT_TYPE.BOOLEAN], false, false, '',
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'new char name', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: 'Renames the current character.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'sysgen',
+ callback: generateSystemMessage,
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'prompt', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: 'Generates a system message using a specified prompt.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'ask',
+ callback: askCharacter,
+ namedArgumentList: [
+ SlashCommandNamedArgument.fromProps({
+ name: 'name',
+ description: 'character name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.characters('character'),
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'prompt', [ARGUMENT_TYPE.STRING], true, false,
+ ),
+ ],
+ helpString: 'Asks a specified character card a prompt. Character name must be provided in a named argument.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'delname',
+ callback: deleteMessagesByNameCallback,
+ namedArgumentList: [],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.characters('character'),
+ }),
+ ],
+ aliases: ['cancel'],
+ helpString: `
Deletes all messages attributed to a specified name.
@@ -444,41 +444,41 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'send',
- callback: sendUserMessageCallback,
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'compact',
- 'whether to use a compact layout',
- [ARGUMENT_TYPE.BOOLEAN],
- false,
- false,
- 'false',
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'at',
- description: 'position to insert the message',
- typeList: [ARGUMENT_TYPE.NUMBER],
- enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
- }),
- SlashCommandNamedArgument.fromProps({
- name: 'name',
- description: 'display name',
- typeList: [ARGUMENT_TYPE.STRING],
- defaultValue: '{{user}}',
- enumProvider: commonEnumProviders.characters('character'),
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text',
- [ARGUMENT_TYPE.STRING],
- true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'send',
+ callback: sendUserMessageCallback,
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'compact',
+ 'whether to use a compact layout',
+ [ARGUMENT_TYPE.BOOLEAN],
+ false,
+ false,
+ 'false',
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'at',
+ description: 'position to insert the message',
+ typeList: [ARGUMENT_TYPE.NUMBER],
+ enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
+ }),
+ SlashCommandNamedArgument.fromProps({
+ name: 'name',
+ description: 'display name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ defaultValue: '{{user}}',
+ enumProvider: commonEnumProviders.characters('character'),
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text',
+ [ARGUMENT_TYPE.STRING],
+ true,
+ ),
+ ],
+ helpString: `
Adds a user message to the chat log without triggering a generation.
@@ -500,29 +500,29 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'trigger',
- callback: triggerGenerationCallback,
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'await',
- 'Whether to await for the triggered generation before continuing',
- [ARGUMENT_TYPE.BOOLEAN],
- false,
- false,
- 'false',
- ),
- ],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'group member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: false,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'trigger',
+ callback: triggerGenerationCallback,
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'await',
+ 'Whether to await for the triggered generation before continuing',
+ [ARGUMENT_TYPE.BOOLEAN],
+ false,
+ false,
+ 'false',
+ ),
+ ],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'group member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: false,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: `
Triggers a message generation. If in group, can trigger a message for the specified group member index or name.
@@ -530,74 +530,74 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
If await=true
named argument is passed, the command will await for the triggered generation before continuing.
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'hide',
- callback: hideMessageCallback,
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'message index (starts with 0) or range',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.RANGE],
- isRequired: true,
- enumProvider: commonEnumProviders.messages(),
- }),
- ],
- helpString: 'Hides a chat message from the prompt.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'unhide',
- callback: unhideMessageCallback,
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'message index (starts with 0) or range',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.RANGE],
- isRequired: true,
- enumProvider: commonEnumProviders.messages(),
- }),
- ],
- helpString: 'Unhides a message from the prompt.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'member-disable',
- callback: disableGroupMemberCallback,
- aliases: ['disable', 'disablemember', 'memberdisable'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: 'Disables a group member from being drafted for replies.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'member-enable',
- aliases: ['enable', 'enablemember', 'memberenable'],
- callback: enableGroupMemberCallback,
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: 'Enables a group member to be drafted for replies.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'member-add',
- callback: addGroupMemberCallback,
- aliases: ['addmember', 'memberadd'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'character name',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: () => selected_group ? commonEnumProviders.characters('character')() : [],
- }),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'hide',
+ callback: hideMessageCallback,
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'message index (starts with 0) or range',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.RANGE],
+ isRequired: true,
+ enumProvider: commonEnumProviders.messages(),
+ }),
+ ],
+ helpString: 'Hides a chat message from the prompt.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'unhide',
+ callback: unhideMessageCallback,
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'message index (starts with 0) or range',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.RANGE],
+ isRequired: true,
+ enumProvider: commonEnumProviders.messages(),
+ }),
+ ],
+ helpString: 'Unhides a message from the prompt.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'member-disable',
+ callback: disableGroupMemberCallback,
+ aliases: ['disable', 'disablemember', 'memberdisable'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: 'Disables a group member from being drafted for replies.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'member-enable',
+ aliases: ['enable', 'enablemember', 'memberenable'],
+ callback: enableGroupMemberCallback,
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: 'Enables a group member to be drafted for replies.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'member-add',
+ callback: addGroupMemberCallback,
+ aliases: ['addmember', 'memberadd'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'character name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: () => selected_group ? commonEnumProviders.characters('character')() : [],
+ }),
+ ],
+ helpString: `
Adds a new group member to the group chat.
@@ -610,20 +610,20 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'member-remove',
- callback: removeGroupMemberCallback,
- aliases: ['removemember', 'memberremove'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'member-remove',
+ callback: removeGroupMemberCallback,
+ aliases: ['removemember', 'memberremove'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: `
Removes a group member from the group chat.
@@ -637,47 +637,47 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'member-up',
- callback: moveGroupMemberUpCallback,
- aliases: ['upmember', 'memberup'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: 'Moves a group member up in the group chat list.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'member-down',
- callback: moveGroupMemberDownCallback,
- aliases: ['downmember', 'memberdown'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: 'Moves a group member down in the group chat list.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'peek',
- callback: peekCallback,
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'member index (starts with 0) or name',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.groupMembers(),
- }),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'member-up',
+ callback: moveGroupMemberUpCallback,
+ aliases: ['upmember', 'memberup'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: 'Moves a group member up in the group chat list.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'member-down',
+ callback: moveGroupMemberDownCallback,
+ aliases: ['downmember', 'memberdown'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: 'Moves a group member down in the group chat list.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'peek',
+ callback: peekCallback,
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'member index (starts with 0) or name',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.groupMembers(),
+ }),
+ ],
+ helpString: `
Shows a group member character card without switching chats.
@@ -691,22 +691,22 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'delswipe',
- callback: deleteSwipeCallback,
- aliases: ['swipedel'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: '1-based swipe id',
- typeList: [ARGUMENT_TYPE.NUMBER],
- isRequired: true,
- enumProvider: () => Array.isArray(chat[chat.length - 1]?.swipes) ?
- chat[chat.length - 1].swipes.map((/** @type {string} */ swipe, /** @type {number} */ i) => new SlashCommandEnumValue(String(i + 1), swipe, enumTypes.enum, enumIcons.message))
- : [],
- }),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'delswipe',
+ callback: deleteSwipeCallback,
+ aliases: ['swipedel'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: '1-based swipe id',
+ typeList: [ARGUMENT_TYPE.NUMBER],
+ isRequired: true,
+ enumProvider: () => Array.isArray(chat[chat.length - 1]?.swipes) ?
+ chat[chat.length - 1].swipes.map((/** @type {string} */ swipe, /** @type {number} */ i) => new SlashCommandEnumValue(String(i + 1), swipe, enumTypes.enum, enumIcons.message))
+ : [],
+ }),
+ ],
+ helpString: `
Deletes a swipe from the last chat message. If swipe id is not provided, it deletes the current swipe.
@@ -724,34 +724,34 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'echo',
- callback: echoCallback,
- returns: 'the text',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'title', 'title of the toast message', [ARGUMENT_TYPE.STRING], false,
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'severity',
- description: 'severity level of the toast message',
- typeList: [ARGUMENT_TYPE.STRING],
- defaultValue: 'info',
- enumProvider: () => [
- new SlashCommandEnumValue('info', 'info', enumTypes.macro, 'ℹ️'),
- new SlashCommandEnumValue('warning', 'warning', enumTypes.enum, '⚠️'),
- new SlashCommandEnumValue('error', 'error', enumTypes.enum, '❗'),
- new SlashCommandEnumValue('success', 'success', enumTypes.enum, '✅'),
- ],
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'echo',
+ callback: echoCallback,
+ returns: 'the text',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'title', 'title of the toast message', [ARGUMENT_TYPE.STRING], false,
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'severity',
+ description: 'severity level of the toast message',
+ typeList: [ARGUMENT_TYPE.STRING],
+ defaultValue: 'info',
+ enumProvider: () => [
+ new SlashCommandEnumValue('info', 'info', enumTypes.macro, 'ℹ️'),
+ new SlashCommandEnumValue('warning', 'warning', enumTypes.enum, '⚠️'),
+ new SlashCommandEnumValue('error', 'error', enumTypes.enum, '❗'),
+ new SlashCommandEnumValue('success', 'success', enumTypes.enum, '✅'),
+ ],
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Echoes the provided text to a toast message. Useful for pipes debugging.
@@ -764,42 +764,42 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'gen',
- callback: generateCallback,
- returns: 'generated text',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'lock', 'lock user input during generation', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'name',
- description: 'in-prompt name for instruct mode',
- typeList: [ARGUMENT_TYPE.STRING],
- defaultValue: 'System',
- enumProvider: () => [...commonEnumProviders.characters('character')(), new SlashCommandEnumValue('System', null, enumTypes.enum, enumIcons.assistant)],
- forceEnum: false,
- }),
- new SlashCommandNamedArgument(
- 'length', 'API response length in tokens', [ARGUMENT_TYPE.NUMBER], false,
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'as',
- description: 'role of the output prompt',
- typeList: [ARGUMENT_TYPE.STRING],
- enumList: [
- new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.assistant),
- new SlashCommandEnumValue('char', null, enumTypes.enum, enumIcons.character),
- ],
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'prompt', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'gen',
+ callback: generateCallback,
+ returns: 'generated text',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'lock', 'lock user input during generation', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'name',
+ description: 'in-prompt name for instruct mode',
+ typeList: [ARGUMENT_TYPE.STRING],
+ defaultValue: 'System',
+ enumProvider: () => [...commonEnumProviders.characters('character')(), new SlashCommandEnumValue('System', null, enumTypes.enum, enumIcons.assistant)],
+ forceEnum: false,
+ }),
+ new SlashCommandNamedArgument(
+ 'length', 'API response length in tokens', [ARGUMENT_TYPE.NUMBER], false,
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'as',
+ description: 'role of the output prompt',
+ typeList: [ARGUMENT_TYPE.STRING],
+ enumList: [
+ new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.assistant),
+ new SlashCommandEnumValue('char', null, enumTypes.enum, enumIcons.character),
+ ],
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'prompt', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Generates text using the provided prompt and passes it to the next command through the pipe, optionally locking user input while generating and allowing to configure the in-prompt name for instruct mode (default = "System").
@@ -807,43 +807,43 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
"as" argument controls the role of the output prompt: system (default) or char. If "length" argument is provided as a number in tokens, allows to temporarily override an API response length.
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'genraw',
- callback: generateRawCallback,
- returns: 'generated text',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'lock', 'lock user input during generation', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'instruct', 'use instruct mode', [ARGUMENT_TYPE.BOOLEAN], false, false, 'on', commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'stop', 'one-time custom stop strings', [ARGUMENT_TYPE.LIST], false,
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'as',
- description: 'role of the output prompt',
- typeList: [ARGUMENT_TYPE.STRING],
- enumList: [
- new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.assistant),
- new SlashCommandEnumValue('char', null, enumTypes.enum, enumIcons.character),
- ],
- }),
- new SlashCommandNamedArgument(
- 'system', 'system prompt at the start', [ARGUMENT_TYPE.STRING], false,
- ),
- new SlashCommandNamedArgument(
- 'length', 'API response length in tokens', [ARGUMENT_TYPE.NUMBER], false,
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'prompt', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'genraw',
+ callback: generateRawCallback,
+ returns: 'generated text',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'lock', 'lock user input during generation', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'instruct', 'use instruct mode', [ARGUMENT_TYPE.BOOLEAN], false, false, 'on', commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'stop', 'one-time custom stop strings', [ARGUMENT_TYPE.LIST], false,
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'as',
+ description: 'role of the output prompt',
+ typeList: [ARGUMENT_TYPE.STRING],
+ enumList: [
+ new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.assistant),
+ new SlashCommandEnumValue('char', null, enumTypes.enum, enumIcons.character),
+ ],
+ }),
+ new SlashCommandNamedArgument(
+ 'system', 'system prompt at the start', [ARGUMENT_TYPE.STRING], false,
+ ),
+ new SlashCommandNamedArgument(
+ 'length', 'API response length in tokens', [ARGUMENT_TYPE.NUMBER], false,
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'prompt', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Generates text using the provided prompt and passes it to the next command through the pipe, optionally locking user input while generating. Does not include chat history or character card.
@@ -860,55 +860,55 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
If "length" argument is provided as a number in tokens, allows to temporarily override an API response length.
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'addswipe',
- callback: addSwipeCallback,
- aliases: ['swipeadd'],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: 'Adds a swipe to the last chat message.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'abort',
- callback: abortCallback,
- namedArgumentList: [
- SlashCommandNamedArgument.fromProps({
- name: 'quiet',
- description: 'Whether to suppress the toast message notifying about the /abort call.',
- typeList: [ARGUMENT_TYPE.BOOLEAN],
- defaultValue: 'true',
- }),
- ],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'The reason for aborting command execution. Shown when quiet=false',
- typeList: [ARGUMENT_TYPE.STRING],
- }),
- ],
- helpString: 'Aborts the slash command batch execution.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'fuzzy',
- callback: fuzzyCallback,
- returns: 'first matching item',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'list', 'list of items to match against', [ARGUMENT_TYPE.LIST], true,
- ),
- new SlashCommandNamedArgument(
- 'threshold', 'fuzzy match threshold (0.0 to 1.0)', [ARGUMENT_TYPE.NUMBER], false, false, '0.4',
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text to search', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'addswipe',
+ callback: addSwipeCallback,
+ aliases: ['swipeadd'],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: 'Adds a swipe to the last chat message.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'abort',
+ callback: abortCallback,
+ namedArgumentList: [
+ SlashCommandNamedArgument.fromProps({
+ name: 'quiet',
+ description: 'Whether to suppress the toast message notifying about the /abort call.',
+ typeList: [ARGUMENT_TYPE.BOOLEAN],
+ defaultValue: 'true',
+ }),
+ ],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'The reason for aborting command execution. Shown when quiet=false',
+ typeList: [ARGUMENT_TYPE.STRING],
+ }),
+ ],
+ helpString: 'Aborts the slash command batch execution.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'fuzzy',
+ callback: fuzzyCallback,
+ returns: 'first matching item',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'list', 'list of items to match against', [ARGUMENT_TYPE.LIST], true,
+ ),
+ new SlashCommandNamedArgument(
+ 'threshold', 'fuzzy match threshold (0.0 to 1.0)', [ARGUMENT_TYPE.NUMBER], false, false, '0.4',
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text to search', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Performs a fuzzy match of each item in the list
against the text to search
.
If any item matches, then its name is returned. If no item matches the text, no value is returned.
@@ -930,23 +930,23 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'pass',
- callback: (_, arg) => {
- // We do not support arrays of closures. Arrays of strings will be send as JSON
- if (Array.isArray(arg) && arg.some(x => x instanceof SlashCommandClosure)) throw new Error('Command /pass does not support multiple closures');
- if (Array.isArray(arg)) return JSON.stringify(arg);
- return arg;
- },
- returns: 'the provided value',
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.BOOLEAN, ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.DICTIONARY, ARGUMENT_TYPE.CLOSURE], true,
- ),
- ],
- aliases: ['return'],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'pass',
+ callback: (_, arg) => {
+ // We do not support arrays of closures. Arrays of strings will be send as JSON
+ if (Array.isArray(arg) && arg.some(x => x instanceof SlashCommandClosure)) throw new Error('Command /pass does not support multiple closures');
+ if (Array.isArray(arg)) return JSON.stringify(arg);
+ return arg;
+ },
+ returns: 'the provided value',
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.BOOLEAN, ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.DICTIONARY, ARGUMENT_TYPE.CLOSURE], true,
+ ),
+ ],
+ aliases: ['return'],
+ helpString: `
/pass (text) – passes the text to the next command through the pipe.
@@ -957,17 +957,17 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'delay',
- callback: delayCallback,
- aliases: ['wait', 'sleep'],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'milliseconds', [ARGUMENT_TYPE.NUMBER], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'delay',
+ callback: delayCallback,
+ aliases: ['wait', 'sleep'],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'milliseconds', [ARGUMENT_TYPE.NUMBER], true,
+ ),
+ ],
+ helpString: `
Delays the next command in the pipe by the specified number of milliseconds.
@@ -980,101 +980,101 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'input',
- aliases: ['prompt'],
- callback: inputCallback,
- returns: 'user input',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'default', 'default value of the input field', [ARGUMENT_TYPE.STRING], false, false, '"string"',
- ),
- new SlashCommandNamedArgument(
- 'large', 'show large input field', [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'wide', 'show wide input field', [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'okButton', 'text for the ok button', [ARGUMENT_TYPE.STRING], false,
- ),
- new SlashCommandNamedArgument(
- 'rows', 'number of rows for the input field', [ARGUMENT_TYPE.NUMBER], false,
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text to display', [ARGUMENT_TYPE.STRING], false,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'input',
+ aliases: ['prompt'],
+ callback: inputCallback,
+ returns: 'user input',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'default', 'default value of the input field', [ARGUMENT_TYPE.STRING], false, false, '"string"',
+ ),
+ new SlashCommandNamedArgument(
+ 'large', 'show large input field', [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'wide', 'show wide input field', [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'okButton', 'text for the ok button', [ARGUMENT_TYPE.STRING], false,
+ ),
+ new SlashCommandNamedArgument(
+ 'rows', 'number of rows for the input field', [ARGUMENT_TYPE.NUMBER], false,
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text to display', [ARGUMENT_TYPE.STRING], false,
+ ),
+ ],
+ helpString: `
Shows a popup with the provided text and an input field.
The default
argument is the default value of the input field, and the text argument is the text to display.
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'run',
- aliases: ['call', 'exec'],
- callback: runCallback,
- returns: 'result of the executed closure of QR',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'args', 'named arguments', [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.BOOLEAN, ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.DICTIONARY], false, true,
- ),
- ],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'scoped variable or qr label',
- typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: () => [
- ...commonEnumProviders.variables('scope')(),
- ...(typeof window['qrEnumProviderExecutables'] === 'function') ? window['qrEnumProviderExecutables']() : [],
- ],
- }),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'run',
+ aliases: ['call', 'exec'],
+ callback: runCallback,
+ returns: 'result of the executed closure of QR',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'args', 'named arguments', [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.BOOLEAN, ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.DICTIONARY], false, true,
+ ),
+ ],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'scoped variable or qr label',
+ typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: () => [
+ ...commonEnumProviders.variables('scope')(),
+ ...(typeof window['qrEnumProviderExecutables'] === 'function') ? window['qrEnumProviderExecutables']() : [],
+ ],
+ }),
+ ],
+ helpString: `
Runs a closure from a scoped variable, or a Quick Reply with the specified name from a currently active preset or from another preset.
Named arguments can be referenced in a QR with {{arg::key}}
.
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'messages',
- callback: getMessagesCallback,
- aliases: ['message'],
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'names', 'show message author names', [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'hidden', 'include hidden messages', [ARGUMENT_TYPE.BOOLEAN], false, false, 'on', commonEnumProviders.boolean('onOff')(),
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'role',
- description: 'filter messages by role',
- typeList: [ARGUMENT_TYPE.STRING],
- enumList: [
- new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.system),
- new SlashCommandEnumValue('assistant', null, enumTypes.enum, enumIcons.assistant),
- new SlashCommandEnumValue('user', null, enumTypes.enum, enumIcons.user),
- ],
- }),
- ],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'message index (starts with 0) or range',
- typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.RANGE],
- isRequired: true,
- enumProvider: commonEnumProviders.messages(),
- }),
- ],
- returns: 'the specified message or range of messages as a string',
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'messages',
+ callback: getMessagesCallback,
+ aliases: ['message'],
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'names', 'show message author names', [ARGUMENT_TYPE.BOOLEAN], false, false, 'off', commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'hidden', 'include hidden messages', [ARGUMENT_TYPE.BOOLEAN], false, false, 'on', commonEnumProviders.boolean('onOff')(),
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'role',
+ description: 'filter messages by role',
+ typeList: [ARGUMENT_TYPE.STRING],
+ enumList: [
+ new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.system),
+ new SlashCommandEnumValue('assistant', null, enumTypes.enum, enumIcons.assistant),
+ new SlashCommandEnumValue('user', null, enumTypes.enum, enumIcons.user),
+ ],
+ }),
+ ],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'message index (starts with 0) or range',
+ typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.RANGE],
+ isRequired: true,
+ enumProvider: commonEnumProviders.messages(),
+ }),
+ ],
+ returns: 'the specified message or range of messages as a string',
+ helpString: `
Returns the specified message or range of messages as a string.
@@ -1098,16 +1098,16 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'setinput',
- callback: setInputCallback,
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'setinput',
+ callback: setInputCallback,
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Sets the user input to the specified text and passes it to the next command through the pipe.
@@ -1120,28 +1120,28 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'popup',
- callback: popupCallback,
- returns: 'popup text',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'large', 'show large popup', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'wide', 'show wide popup', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
- ),
- new SlashCommandNamedArgument(
- 'okButton', 'text for the OK button', [ARGUMENT_TYPE.STRING], false,
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'popup',
+ callback: popupCallback,
+ returns: 'popup text',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'large', 'show large popup', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'wide', 'show wide popup', [ARGUMENT_TYPE.BOOLEAN], false, false, null, commonEnumProviders.boolean('onOff')(),
+ ),
+ new SlashCommandNamedArgument(
+ 'okButton', 'text for the OK button', [ARGUMENT_TYPE.STRING], false,
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Shows a blocking popup with the specified text and buttons.
Returns the popup text.
@@ -1155,22 +1155,22 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'buttons',
- callback: buttonsCallback,
- returns: 'clicked button label',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'labels', 'button labels', [ARGUMENT_TYPE.LIST], true,
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'buttons',
+ callback: buttonsCallback,
+ returns: 'clicked button label',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'labels', 'button labels', [ARGUMENT_TYPE.LIST], true,
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Shows a blocking popup with the specified text and buttons.
Returns the clicked button label into the pipe or empty string if canceled.
@@ -1184,32 +1184,32 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'trimtokens',
- callback: trimTokensCallback,
- returns: 'trimmed text',
- namedArgumentList: [
- new SlashCommandNamedArgument(
- 'limit', 'number of tokens to keep', [ARGUMENT_TYPE.NUMBER], true,
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'direction',
- description: 'trim direction',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumList: [
- new SlashCommandEnumValue('start', null, enumTypes.enum, '⏪'),
- new SlashCommandEnumValue('end', null, enumTypes.enum, '⏩'),
- ],
- }),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], false,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'trimtokens',
+ callback: trimTokensCallback,
+ returns: 'trimmed text',
+ namedArgumentList: [
+ new SlashCommandNamedArgument(
+ 'limit', 'number of tokens to keep', [ARGUMENT_TYPE.NUMBER], true,
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'direction',
+ description: 'trim direction',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumList: [
+ new SlashCommandEnumValue('start', null, enumTypes.enum, '⏪'),
+ new SlashCommandEnumValue('end', null, enumTypes.enum, '⏩'),
+ ],
+ }),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], false,
+ ),
+ ],
+ helpString: `
Trims the start or end of text to the specified number of tokens.
@@ -1222,17 +1222,17 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'trimstart',
- callback: trimStartCallback,
- returns: 'trimmed text',
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: `
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'trimstart',
+ callback: trimStartCallback,
+ returns: 'trimmed text',
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: `
Trims the text to the start of the first full sentence.
@@ -1245,148 +1245,149 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
`,
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'trimend',
- callback: trimEndCallback,
- returns: 'trimmed text',
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: 'Trims the text to the end of the last full sentence.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'inject',
- callback: injectCallback,
- namedArgumentList: [
- SlashCommandNamedArgument.fromProps({
- name: 'id',
- description: 'injection ID or variable name pointing to ID',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- enumProvider: commonEnumProviders.injects,
- }),
- new SlashCommandNamedArgument(
- 'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat'],
- ),
- new SlashCommandNamedArgument(
- 'depth', 'injection depth', [ARGUMENT_TYPE.NUMBER], false, false, '4',
- ),
- new SlashCommandNamedArgument(
- 'scan', 'include injection content into World Info scans', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
- ),
- SlashCommandNamedArgument.fromProps({
- name: 'role',
- description: 'role for in-chat injections',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: false,
- enumList: [
- new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.system),
- new SlashCommandEnumValue('assistant', null, enumTypes.enum, enumIcons.assistant),
- new SlashCommandEnumValue('user', null, enumTypes.enum, enumIcons.user),
- ],
- }),
- new SlashCommandNamedArgument(
- 'ephemeral', 'remove injection after generation', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
- ),
- ],
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], false,
- ),
- ],
- helpString: 'Injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat" (default: after). Depth: injection depth for the prompt (default: 4). Role: role for in-chat injections (default: system). Scan: include injection content into World Info scans (default: false).',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'listinjects',
- callback: listInjectsCallback,
- helpString: 'Lists all script injections for the current chat.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'flushinject',
- aliases: ['flushinjects'],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'injection ID or a variable name pointing to ID',
- typeList: [ARGUMENT_TYPE.STRING],
- defaultValue: '',
- enumProvider: commonEnumProviders.injects,
- }),
- ],
- callback: flushInjectsCallback,
- helpString: 'Removes a script injection for the current chat. If no ID is provided, removes all script injections.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'tokens',
- callback: (_, text) => {
- if (text instanceof SlashCommandClosure || Array.isArray(text)) throw new Error('Unnamed argument cannot be a closure for command /tokens');
- return getTokenCountAsync(text).then(count => String(count));
- },
- returns: 'number of tokens',
- unnamedArgumentList: [
- new SlashCommandArgument(
- 'text', [ARGUMENT_TYPE.STRING], true,
- ),
- ],
- helpString: 'Counts the number of tokens in the provided text.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'model',
- callback: modelCallback,
- returns: 'current model',
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'model name',
- typeList: [ARGUMENT_TYPE.STRING],
- enumProvider: () => getModelOptions()?.options.map(option => new SlashCommandEnumValue(option.value, option.value !== option.text ? option.text : null)),
- }),
- ],
- helpString: 'Sets the model for the current API. Gets the current model name if no argument is provided.',
-}));
-SlashCommandParser.addCommandObject(SlashCommand.fromProps({
- name: 'setpromptentry',
- aliases: ['setpromptentries'],
- callback: setPromptEntryCallback,
- namedArgumentList: [
- SlashCommandNamedArgument.fromProps({
- name: 'identifier',
- description: 'Prompt entry identifier(s) to target',
- typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.LIST],
- acceptsMultiple: true,
- enumProvider: () => {
- const promptManager = setupChatCompletionPromptManager(oai_settings);
- const prompts = promptManager.serviceSettings.prompts;
- return prompts.map(prompt => new SlashCommandEnumValue(prompt.identifier, prompt.name, enumTypes.enum));
- },
- }),
- SlashCommandNamedArgument.fromProps({
- name: 'name',
- description: 'Prompt entry name(s) to target',
- typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.LIST],
- acceptsMultiple: true,
- enumProvider: () => {
- const promptManager = setupChatCompletionPromptManager(oai_settings);
- const prompts = promptManager.serviceSettings.prompts;
- return prompts.map(prompt => new SlashCommandEnumValue(prompt.name, prompt.identifier, enumTypes.enum));
- },
- }),
- ],
- unnamedArgumentList: [
- SlashCommandArgument.fromProps({
- description: 'Set entry/entries on or off',
- typeList: [ARGUMENT_TYPE.STRING],
- isRequired: true,
- acceptsMultiple: false,
- defaultValue: 'toggle', // unnamed arguments don't support default values yet
- enumList: commonEnumProviders.boolean('onOffToggle')(),
- }),
- ],
- helpString: 'Sets the specified prompt manager entry/entries on or off.',
-}));
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'trimend',
+ callback: trimEndCallback,
+ returns: 'trimmed text',
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: 'Trims the text to the end of the last full sentence.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'inject',
+ callback: injectCallback,
+ namedArgumentList: [
+ SlashCommandNamedArgument.fromProps({
+ name: 'id',
+ description: 'injection ID or variable name pointing to ID',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ enumProvider: commonEnumProviders.injects,
+ }),
+ new SlashCommandNamedArgument(
+ 'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat'],
+ ),
+ new SlashCommandNamedArgument(
+ 'depth', 'injection depth', [ARGUMENT_TYPE.NUMBER], false, false, '4',
+ ),
+ new SlashCommandNamedArgument(
+ 'scan', 'include injection content into World Info scans', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
+ ),
+ SlashCommandNamedArgument.fromProps({
+ name: 'role',
+ description: 'role for in-chat injections',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: false,
+ enumList: [
+ new SlashCommandEnumValue('system', null, enumTypes.enum, enumIcons.system),
+ new SlashCommandEnumValue('assistant', null, enumTypes.enum, enumIcons.assistant),
+ new SlashCommandEnumValue('user', null, enumTypes.enum, enumIcons.user),
+ ],
+ }),
+ new SlashCommandNamedArgument(
+ 'ephemeral', 'remove injection after generation', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
+ ),
+ ],
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], false,
+ ),
+ ],
+ helpString: 'Injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat" (default: after). Depth: injection depth for the prompt (default: 4). Role: role for in-chat injections (default: system). Scan: include injection content into World Info scans (default: false).',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'listinjects',
+ callback: listInjectsCallback,
+ helpString: 'Lists all script injections for the current chat.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'flushinject',
+ aliases: ['flushinjects'],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'injection ID or a variable name pointing to ID',
+ typeList: [ARGUMENT_TYPE.STRING],
+ defaultValue: '',
+ enumProvider: commonEnumProviders.injects,
+ }),
+ ],
+ callback: flushInjectsCallback,
+ helpString: 'Removes a script injection for the current chat. If no ID is provided, removes all script injections.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'tokens',
+ callback: (_, text) => {
+ if (text instanceof SlashCommandClosure || Array.isArray(text)) throw new Error('Unnamed argument cannot be a closure for command /tokens');
+ return getTokenCountAsync(text).then(count => String(count));
+ },
+ returns: 'number of tokens',
+ unnamedArgumentList: [
+ new SlashCommandArgument(
+ 'text', [ARGUMENT_TYPE.STRING], true,
+ ),
+ ],
+ helpString: 'Counts the number of tokens in the provided text.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'model',
+ callback: modelCallback,
+ returns: 'current model',
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'model name',
+ typeList: [ARGUMENT_TYPE.STRING],
+ enumProvider: () => getModelOptions()?.options.map(option => new SlashCommandEnumValue(option.value, option.value !== option.text ? option.text : null)),
+ }),
+ ],
+ helpString: 'Sets the model for the current API. Gets the current model name if no argument is provided.',
+ }));
+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
+ name: 'setpromptentry',
+ aliases: ['setpromptentries'],
+ callback: setPromptEntryCallback,
+ namedArgumentList: [
+ SlashCommandNamedArgument.fromProps({
+ name: 'identifier',
+ description: 'Prompt entry identifier(s) to target',
+ typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.LIST],
+ acceptsMultiple: true,
+ enumProvider: () => {
+ const promptManager = setupChatCompletionPromptManager(oai_settings);
+ const prompts = promptManager.serviceSettings.prompts;
+ return prompts.map(prompt => new SlashCommandEnumValue(prompt.identifier, prompt.name, enumTypes.enum));
+ },
+ }),
+ SlashCommandNamedArgument.fromProps({
+ name: 'name',
+ description: 'Prompt entry name(s) to target',
+ typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.LIST],
+ acceptsMultiple: true,
+ enumProvider: () => {
+ const promptManager = setupChatCompletionPromptManager(oai_settings);
+ const prompts = promptManager.serviceSettings.prompts;
+ return prompts.map(prompt => new SlashCommandEnumValue(prompt.name, prompt.identifier, enumTypes.enum));
+ },
+ }),
+ ],
+ unnamedArgumentList: [
+ SlashCommandArgument.fromProps({
+ description: 'Set entry/entries on or off',
+ typeList: [ARGUMENT_TYPE.STRING],
+ isRequired: true,
+ acceptsMultiple: false,
+ defaultValue: 'toggle', // unnamed arguments don't support default values yet
+ enumList: commonEnumProviders.boolean('onOffToggle')(),
+ }),
+ ],
+ helpString: 'Sets the specified prompt manager entry/entries on or off.',
+ }));
-registerVariableCommands();
+ registerVariableCommands();
+}
const NARRATOR_NAME_KEY = 'narrator_name';
const NARRATOR_NAME_DEFAULT = 'System';