mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor main slassh-commands into init func
This commit is contained in:
@ -159,7 +159,7 @@ import {
|
|||||||
import { debounce_timeout } from './scripts/constants.js';
|
import { debounce_timeout } from './scripts/constants.js';
|
||||||
|
|
||||||
import { ModuleWorkerWrapper, doDailyExtensionUpdatesCheck, extension_settings, getContext, loadExtensionSettings, renderExtensionTemplate, renderExtensionTemplateAsync, runGenerationInterceptors, saveMetadataDebounced, writeExtensionField } from './scripts/extensions.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 {
|
import {
|
||||||
tag_map,
|
tag_map,
|
||||||
tags,
|
tags,
|
||||||
@ -911,6 +911,7 @@ async function firstLoadInit() {
|
|||||||
initKeyboard();
|
initKeyboard();
|
||||||
initDynamicStyles();
|
initDynamicStyles();
|
||||||
initTags();
|
initTags();
|
||||||
|
initDefaultSlashCommands();
|
||||||
await getUserAvatars(true, user_avatar);
|
await getUserAvatars(true, user_avatar);
|
||||||
await getCharacters();
|
await getCharacters();
|
||||||
await getBackgrounds();
|
await getBackgrounds();
|
||||||
|
@ -38,13 +38,13 @@ import {
|
|||||||
system_message_types,
|
system_message_types,
|
||||||
this_chid,
|
this_chid,
|
||||||
} from '../script.js';
|
} 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 { SlashCommandParserError } from './slash-commands/SlashCommandParserError.js';
|
||||||
import { getMessageTimeStamp } from './RossAscends-mods.js';
|
import { getMessageTimeStamp } from './RossAscends-mods.js';
|
||||||
import { hideChatMessageRange } from './chats.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 { 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 { chat_completion_sources, oai_settings, setupChatCompletionPromptManager } from './openai.js';
|
||||||
import { autoSelectPersona, retriggerFirstMessageOnEmptyChat, setPersonaLockState, togglePersonaLock, user_avatar } from './personas.js';
|
import { autoSelectPersona, retriggerFirstMessageOnEmptyChat, setPersonaLockState, togglePersonaLock, user_avatar } from './personas.js';
|
||||||
import { addEphemeralStoppingString, chat_styles, flushEphemeralStoppingStrings, power_user } from './power-user.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 { debounce, delay, isFalseBoolean, isTrueBoolean, stringToRange, trimToEndSentence, trimToStartSentence, waitUntilCondition } from './utils.js';
|
||||||
import { registerVariableCommands, resolveVariable } from './variables.js';
|
import { registerVariableCommands, resolveVariable } from './variables.js';
|
||||||
import { background_settings } from './backgrounds.js';
|
import { background_settings } from './backgrounds.js';
|
||||||
import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';
|
|
||||||
import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
|
import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
|
||||||
import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';
|
import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';
|
||||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
|
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
|
||||||
@ -75,7 +74,8 @@ export const parser = new SlashCommandParser();
|
|||||||
const registerSlashCommand = SlashCommandParser.addCommand.bind(SlashCommandParser);
|
const registerSlashCommand = SlashCommandParser.addCommand.bind(SlashCommandParser);
|
||||||
const getSlashCommandsHelp = parser.getHelpString.bind(parser);
|
const getSlashCommandsHelp = parser.getHelpString.bind(parser);
|
||||||
|
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
export function initDefaultSlashCommands() {
|
||||||
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: '?',
|
name: '?',
|
||||||
callback: helpCommandCallback,
|
callback: helpCommandCallback,
|
||||||
aliases: ['help'],
|
aliases: ['help'],
|
||||||
@ -90,8 +90,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
],
|
],
|
||||||
})],
|
})],
|
||||||
helpString: 'Get help on macros, chat formatting and commands.',
|
helpString: 'Get help on macros, chat formatting and commands.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'persona',
|
name: 'persona',
|
||||||
callback: setNameCallback,
|
callback: setNameCallback,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -110,13 +110,13 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
],
|
],
|
||||||
helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.',
|
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'],
|
aliases: ['name'],
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'sync',
|
name: 'sync',
|
||||||
callback: syncCallback,
|
callback: syncCallback,
|
||||||
helpString: 'Syncs the user persona in user-attributed messages in the current chat.',
|
helpString: 'Syncs the user persona in user-attributed messages in the current chat.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'lock',
|
name: 'lock',
|
||||||
callback: lockPersonaCallback,
|
callback: lockPersonaCallback,
|
||||||
aliases: ['bind'],
|
aliases: ['bind'],
|
||||||
@ -130,8 +130,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
enumProvider: commonEnumProviders.boolean('onOffToggle'),
|
enumProvider: commonEnumProviders.boolean('onOffToggle'),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'bg',
|
name: 'bg',
|
||||||
callback: setBackgroundCallback,
|
callback: setBackgroundCallback,
|
||||||
aliases: ['background'],
|
aliases: ['background'],
|
||||||
@ -159,8 +159,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'sendas',
|
name: 'sendas',
|
||||||
callback: sendMessageAs,
|
callback: sendMessageAs,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -204,8 +204,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
If "compact" is set to true, the message is sent using a compact layout.
|
If "compact" is set to true, the message is sent using a compact layout.
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'sys',
|
name: 'sys',
|
||||||
callback: sendNarratorMessage,
|
callback: sendNarratorMessage,
|
||||||
aliases: ['nar'],
|
aliases: ['nar'],
|
||||||
@ -249,8 +249,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'sysname',
|
name: 'sysname',
|
||||||
callback: setNarratorName,
|
callback: setNarratorName,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -259,8 +259,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.',
|
helpString: 'Sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'comment',
|
name: 'comment',
|
||||||
callback: sendCommentMessage,
|
callback: sendCommentMessage,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -305,26 +305,26 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'single',
|
name: 'single',
|
||||||
callback: setStoryModeCallback,
|
callback: setStoryModeCallback,
|
||||||
aliases: ['story'],
|
aliases: ['story'],
|
||||||
helpString: 'Sets the message style to single document mode without names or avatars visible.',
|
helpString: 'Sets the message style to single document mode without names or avatars visible.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'bubble',
|
name: 'bubble',
|
||||||
callback: setBubbleModeCallback,
|
callback: setBubbleModeCallback,
|
||||||
aliases: ['bubbles'],
|
aliases: ['bubbles'],
|
||||||
helpString: 'Sets the message style to bubble chat mode.',
|
helpString: 'Sets the message style to bubble chat mode.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'flat',
|
name: 'flat',
|
||||||
callback: setFlatModeCallback,
|
callback: setFlatModeCallback,
|
||||||
aliases: ['default'],
|
aliases: ['default'],
|
||||||
helpString: 'Sets the message style to flat chat mode.',
|
helpString: 'Sets the message style to flat chat mode.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'continue',
|
name: 'continue',
|
||||||
callback: continueChatCallback,
|
callback: continueChatCallback,
|
||||||
aliases: ['cont'],
|
aliases: ['cont'],
|
||||||
@ -351,8 +351,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'go',
|
name: 'go',
|
||||||
callback: goToCharacterCallback,
|
callback: goToCharacterCallback,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -365,8 +365,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
],
|
],
|
||||||
helpString: 'Opens up a chat with the character or group by its name',
|
helpString: 'Opens up a chat with the character or group by its name',
|
||||||
aliases: ['char'],
|
aliases: ['char'],
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'rename-char',
|
name: 'rename-char',
|
||||||
/** @param {{silent: string, chats: string}} options @param {string} name */
|
/** @param {{silent: string, chats: string}} options @param {string} name */
|
||||||
callback: async ({ silent = 'true', chats = null }, name) => {
|
callback: async ({ silent = 'true', chats = null }, name) => {
|
||||||
@ -388,8 +388,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Renames the current character.',
|
helpString: 'Renames the current character.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'sysgen',
|
name: 'sysgen',
|
||||||
callback: generateSystemMessage,
|
callback: generateSystemMessage,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -398,8 +398,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Generates a system message using a specified prompt.',
|
helpString: 'Generates a system message using a specified prompt.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'ask',
|
name: 'ask',
|
||||||
callback: askCharacter,
|
callback: askCharacter,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -417,8 +417,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Asks a specified character card a prompt. Character name must be provided in a named argument.',
|
helpString: 'Asks a specified character card a prompt. Character name must be provided in a named argument.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'delname',
|
name: 'delname',
|
||||||
callback: deleteMessagesByNameCallback,
|
callback: deleteMessagesByNameCallback,
|
||||||
namedArgumentList: [],
|
namedArgumentList: [],
|
||||||
@ -444,8 +444,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'send',
|
name: 'send',
|
||||||
callback: sendUserMessageCallback,
|
callback: sendUserMessageCallback,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -500,8 +500,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'trigger',
|
name: 'trigger',
|
||||||
callback: triggerGenerationCallback,
|
callback: triggerGenerationCallback,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -530,8 +530,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
If <code>await=true</code> named argument is passed, the command will await for the triggered generation before continuing.
|
If <code>await=true</code> named argument is passed, the command will await for the triggered generation before continuing.
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'hide',
|
name: 'hide',
|
||||||
callback: hideMessageCallback,
|
callback: hideMessageCallback,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -543,8 +543,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Hides a chat message from the prompt.',
|
helpString: 'Hides a chat message from the prompt.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'unhide',
|
name: 'unhide',
|
||||||
callback: unhideMessageCallback,
|
callback: unhideMessageCallback,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -556,8 +556,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Unhides a message from the prompt.',
|
helpString: 'Unhides a message from the prompt.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'member-disable',
|
name: 'member-disable',
|
||||||
callback: disableGroupMemberCallback,
|
callback: disableGroupMemberCallback,
|
||||||
aliases: ['disable', 'disablemember', 'memberdisable'],
|
aliases: ['disable', 'disablemember', 'memberdisable'],
|
||||||
@ -570,8 +570,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Disables a group member from being drafted for replies.',
|
helpString: 'Disables a group member from being drafted for replies.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'member-enable',
|
name: 'member-enable',
|
||||||
aliases: ['enable', 'enablemember', 'memberenable'],
|
aliases: ['enable', 'enablemember', 'memberenable'],
|
||||||
callback: enableGroupMemberCallback,
|
callback: enableGroupMemberCallback,
|
||||||
@ -584,8 +584,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Enables a group member to be drafted for replies.',
|
helpString: 'Enables a group member to be drafted for replies.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'member-add',
|
name: 'member-add',
|
||||||
callback: addGroupMemberCallback,
|
callback: addGroupMemberCallback,
|
||||||
aliases: ['addmember', 'memberadd'],
|
aliases: ['addmember', 'memberadd'],
|
||||||
@ -610,8 +610,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'member-remove',
|
name: 'member-remove',
|
||||||
callback: removeGroupMemberCallback,
|
callback: removeGroupMemberCallback,
|
||||||
aliases: ['removemember', 'memberremove'],
|
aliases: ['removemember', 'memberremove'],
|
||||||
@ -637,8 +637,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'member-up',
|
name: 'member-up',
|
||||||
callback: moveGroupMemberUpCallback,
|
callback: moveGroupMemberUpCallback,
|
||||||
aliases: ['upmember', 'memberup'],
|
aliases: ['upmember', 'memberup'],
|
||||||
@ -651,8 +651,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Moves a group member up in the group chat list.',
|
helpString: 'Moves a group member up in the group chat list.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'member-down',
|
name: 'member-down',
|
||||||
callback: moveGroupMemberDownCallback,
|
callback: moveGroupMemberDownCallback,
|
||||||
aliases: ['downmember', 'memberdown'],
|
aliases: ['downmember', 'memberdown'],
|
||||||
@ -665,8 +665,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Moves a group member down in the group chat list.',
|
helpString: 'Moves a group member down in the group chat list.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'peek',
|
name: 'peek',
|
||||||
callback: peekCallback,
|
callback: peekCallback,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -691,8 +691,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'delswipe',
|
name: 'delswipe',
|
||||||
callback: deleteSwipeCallback,
|
callback: deleteSwipeCallback,
|
||||||
aliases: ['swipedel'],
|
aliases: ['swipedel'],
|
||||||
@ -724,8 +724,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'echo',
|
name: 'echo',
|
||||||
callback: echoCallback,
|
callback: echoCallback,
|
||||||
returns: 'the text',
|
returns: 'the text',
|
||||||
@ -764,8 +764,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'gen',
|
name: 'gen',
|
||||||
callback: generateCallback,
|
callback: generateCallback,
|
||||||
returns: 'generated text',
|
returns: 'generated text',
|
||||||
@ -807,8 +807,8 @@ 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.
|
"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.
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'genraw',
|
name: 'genraw',
|
||||||
callback: generateRawCallback,
|
callback: generateRawCallback,
|
||||||
returns: 'generated text',
|
returns: 'generated text',
|
||||||
@ -860,8 +860,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
If "length" argument is provided as a number in tokens, allows to temporarily override an API response length.
|
If "length" argument is provided as a number in tokens, allows to temporarily override an API response length.
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'addswipe',
|
name: 'addswipe',
|
||||||
callback: addSwipeCallback,
|
callback: addSwipeCallback,
|
||||||
aliases: ['swipeadd'],
|
aliases: ['swipeadd'],
|
||||||
@ -871,8 +871,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Adds a swipe to the last chat message.',
|
helpString: 'Adds a swipe to the last chat message.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'abort',
|
name: 'abort',
|
||||||
callback: abortCallback,
|
callback: abortCallback,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -890,8 +890,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Aborts the slash command batch execution.',
|
helpString: 'Aborts the slash command batch execution.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'fuzzy',
|
name: 'fuzzy',
|
||||||
callback: fuzzyCallback,
|
callback: fuzzyCallback,
|
||||||
returns: 'first matching item',
|
returns: 'first matching item',
|
||||||
@ -930,8 +930,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'pass',
|
name: 'pass',
|
||||||
callback: (_, arg) => {
|
callback: (_, arg) => {
|
||||||
// We do not support arrays of closures. Arrays of strings will be send as JSON
|
// We do not support arrays of closures. Arrays of strings will be send as JSON
|
||||||
@ -957,8 +957,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'delay',
|
name: 'delay',
|
||||||
callback: delayCallback,
|
callback: delayCallback,
|
||||||
aliases: ['wait', 'sleep'],
|
aliases: ['wait', 'sleep'],
|
||||||
@ -980,8 +980,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'input',
|
name: 'input',
|
||||||
aliases: ['prompt'],
|
aliases: ['prompt'],
|
||||||
callback: inputCallback,
|
callback: inputCallback,
|
||||||
@ -1014,8 +1014,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
The <code>default</code> argument is the default value of the input field, and the text argument is the text to display.
|
The <code>default</code> argument is the default value of the input field, and the text argument is the text to display.
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'run',
|
name: 'run',
|
||||||
aliases: ['call', 'exec'],
|
aliases: ['call', 'exec'],
|
||||||
callback: runCallback,
|
callback: runCallback,
|
||||||
@ -1042,8 +1042,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
Named arguments can be referenced in a QR with <code>{{arg::key}}</code>.
|
Named arguments can be referenced in a QR with <code>{{arg::key}}</code>.
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'messages',
|
name: 'messages',
|
||||||
callback: getMessagesCallback,
|
callback: getMessagesCallback,
|
||||||
aliases: ['message'],
|
aliases: ['message'],
|
||||||
@ -1098,8 +1098,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'setinput',
|
name: 'setinput',
|
||||||
callback: setInputCallback,
|
callback: setInputCallback,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -1120,8 +1120,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'popup',
|
name: 'popup',
|
||||||
callback: popupCallback,
|
callback: popupCallback,
|
||||||
returns: 'popup text',
|
returns: 'popup text',
|
||||||
@ -1155,8 +1155,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'buttons',
|
name: 'buttons',
|
||||||
callback: buttonsCallback,
|
callback: buttonsCallback,
|
||||||
returns: 'clicked button label',
|
returns: 'clicked button label',
|
||||||
@ -1184,8 +1184,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'trimtokens',
|
name: 'trimtokens',
|
||||||
callback: trimTokensCallback,
|
callback: trimTokensCallback,
|
||||||
returns: 'trimmed text',
|
returns: 'trimmed text',
|
||||||
@ -1222,8 +1222,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'trimstart',
|
name: 'trimstart',
|
||||||
callback: trimStartCallback,
|
callback: trimStartCallback,
|
||||||
returns: 'trimmed text',
|
returns: 'trimmed text',
|
||||||
@ -1245,8 +1245,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'trimend',
|
name: 'trimend',
|
||||||
callback: trimEndCallback,
|
callback: trimEndCallback,
|
||||||
returns: 'trimmed text',
|
returns: 'trimmed text',
|
||||||
@ -1256,8 +1256,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Trims the text to the end of the last full sentence.',
|
helpString: 'Trims the text to the end of the last full sentence.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'inject',
|
name: 'inject',
|
||||||
callback: injectCallback,
|
callback: injectCallback,
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
@ -1298,13 +1298,13 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
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).',
|
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({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'listinjects',
|
name: 'listinjects',
|
||||||
callback: listInjectsCallback,
|
callback: listInjectsCallback,
|
||||||
helpString: 'Lists all script injections for the current chat.',
|
helpString: 'Lists all script injections for the current chat.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'flushinject',
|
name: 'flushinject',
|
||||||
aliases: ['flushinjects'],
|
aliases: ['flushinjects'],
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@ -1317,8 +1317,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
],
|
],
|
||||||
callback: flushInjectsCallback,
|
callback: flushInjectsCallback,
|
||||||
helpString: 'Removes a script injection for the current chat. If no ID is provided, removes all script injections.',
|
helpString: 'Removes a script injection for the current chat. If no ID is provided, removes all script injections.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'tokens',
|
name: 'tokens',
|
||||||
callback: (_, text) => {
|
callback: (_, text) => {
|
||||||
if (text instanceof SlashCommandClosure || Array.isArray(text)) throw new Error('Unnamed argument cannot be a closure for command /tokens');
|
if (text instanceof SlashCommandClosure || Array.isArray(text)) throw new Error('Unnamed argument cannot be a closure for command /tokens');
|
||||||
@ -1331,8 +1331,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
helpString: 'Counts the number of tokens in the provided text.',
|
helpString: 'Counts the number of tokens in the provided text.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'model',
|
name: 'model',
|
||||||
callback: modelCallback,
|
callback: modelCallback,
|
||||||
returns: 'current model',
|
returns: 'current model',
|
||||||
@ -1344,8 +1344,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Sets the model for the current API. Gets the current model name if no argument is provided.',
|
helpString: 'Sets the model for the current API. Gets the current model name if no argument is provided.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'setpromptentry',
|
name: 'setpromptentry',
|
||||||
aliases: ['setpromptentries'],
|
aliases: ['setpromptentries'],
|
||||||
callback: setPromptEntryCallback,
|
callback: setPromptEntryCallback,
|
||||||
@ -1384,9 +1384,10 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Sets the specified prompt manager entry/entries on or off.',
|
helpString: 'Sets the specified prompt manager entry/entries on or off.',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
registerVariableCommands();
|
registerVariableCommands();
|
||||||
|
}
|
||||||
|
|
||||||
const NARRATOR_NAME_KEY = 'narrator_name';
|
const NARRATOR_NAME_KEY = 'narrator_name';
|
||||||
const NARRATOR_NAME_DEFAULT = 'System';
|
const NARRATOR_NAME_DEFAULT = 'System';
|
||||||
|
Reference in New Issue
Block a user