Refactor main slassh-commands into init func
| @@ -159,7 +159,7 @@ import { | ||
| 159 | 159 | import { debounce_timeout } from './scripts/constants.js'; |
| 160 | 160 | |
| 161 | 161 | import { ModuleWorkerWrapper, doDailyExtensionUpdatesCheck, extension_settings, getContext, loadExtensionSettings, renderExtensionTemplate, renderExtensionTemplateAsync, runGenerationInterceptors, saveMetadataDebounced, writeExtensionField } from './scripts/extensions.js'; |
| 162 | 162 | import { COMMENT_NAME_DEFAULT, executeSlashCommands, executeSlashCommandsOnChatInput, getSlashCommandsHelp, initDefaultSlashCommands, isExecutingCommandsFromChatInput, pauseScriptExecution, processChatSlashCommands, registerSlashCommand, stopScriptExecution } from './scripts/slash-commands.js'; |
| 163 | 163 | import { |
| 164 | 164 | tag_map, |
| 165 | 165 | tags, |
| @@ -911,6 +911,7 @@ async function firstLoadInit() { | ||
| 911 | 911 | initKeyboard(); |
| 912 | 912 | initDynamicStyles(); |
| 913 | 913 | initTags(); |
| 914 | + initDefaultSlashCommands(); | |
| 914 | 915 | await getUserAvatars(true, user_avatar); |
| 915 | 916 | await getCharacters(); |
| 916 | 917 | await getBackgrounds(); |
| @@ -38,13 +38,13 @@ import { | ||
| 38 | 38 | system_message_types, |
| 39 | 39 | this_chid, |
| 40 | 40 | } from '../script.js'; |
| 41 | 41 | import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js'; |
| 42 | 42 | import { SlashCommandParserError } from './slash-commands/SlashCommandParserError.js'; |
| 43 | 43 | import { getMessageTimeStamp } from './RossAscends-mods.js'; |
| 44 | 44 | import { hideChatMessageRange } from './chats.js'; |
| 45 | 45 | import { extension_settings, getContext, saveMetadataDebounced } from './extensions.js'; |
| 46 | 46 | import { getRegexedString, regex_placement } from './extensions/regex/engine.js'; |
| 47 | 47 | import { findGroupMemberId, getGroupMembers, groups, is_group_generating, openGroupById, resetSelectedGroup, saveGroupChat, selected_group } from './group-chats.js'; |
| 48 | 48 | import { chat_completion_sources, oai_settings, setupChatCompletionPromptManager } from './openai.js'; |
| 49 | 49 | import { autoSelectPersona, retriggerFirstMessageOnEmptyChat, setPersonaLockState, togglePersonaLock, user_avatar } from './personas.js'; |
| 50 | 50 | import { addEphemeralStoppingString, chat_styles, flushEphemeralStoppingStrings, power_user } from './power-user.js'; |
| @@ -53,7 +53,6 @@ import { decodeTextTokens, getFriendlyTokenizerName, getTextTokens, getTokenCoun | ||
| 53 | 53 | import { debounce, delay, isFalseBoolean, isTrueBoolean, stringToRange, trimToEndSentence, trimToStartSentence, waitUntilCondition } from './utils.js'; |
| 54 | 54 | import { registerVariableCommands, resolveVariable } from './variables.js'; |
| 55 | 55 | import { background_settings } from './backgrounds.js'; |
| 56 | -import { SlashCommandScope } from './slash-commands/SlashCommandScope.js'; | |
| 57 | 56 | import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js'; |
| 58 | 57 | import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js'; |
| 59 | 58 | import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js'; |
| @@ -75,6 +74,7 @@ export const parser = new SlashCommandParser(); | ||
| 75 | 74 | const registerSlashCommand = SlashCommandParser.addCommand.bind(SlashCommandParser); |
| 76 | 75 | const getSlashCommandsHelp = parser.getHelpString.bind(parser); |
| 77 | 76 | |
| 77 | +export function initDefaultSlashCommands() { | |
| 78 | 78 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 79 | 79 | name: '?', |
| 80 | 80 | callback: helpCommandCallback, |
| @@ -1387,6 +1387,7 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | ||
| 1387 | 1387 | })); |
| 1388 | 1388 | |
| 1389 | 1389 | registerVariableCommands(); |
| 1390 | +} | |
| 1390 | 1391 | |
| 1391 | 1392 | const NARRATOR_NAME_KEY = 'narrator_name'; |
| 1392 | 1393 | const NARRATOR_NAME_DEFAULT = 'System'; |