From 63a0ebb885698063a358b5ce0f66e1c0488128f2 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Thu, 11 Jul 2024 22:43:25 +0200 Subject: [PATCH] Move openai slash commands to init function --- public/script.js | 2 ++ public/scripts/openai.js | 33 +++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/public/script.js b/public/script.js index f6cf2dba9..b6820e313 100644 --- a/public/script.js +++ b/public/script.js @@ -101,6 +101,7 @@ import { proxies, loadProxyPresets, selected_proxy, + initOpenai, } from './scripts/openai.js'; import { @@ -915,6 +916,7 @@ async function firstLoadInit() { initKeyboard(); initDynamicStyles(); initTags(); + initOpenai(); await getUserAvatars(true, user_avatar); await getCharacters(); await getBackgrounds(); diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 00d319121..b30894f41 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -4679,22 +4679,23 @@ function runProxyCallback(_, value) { return foundName; } -SlashCommandParser.addCommandObject(SlashCommand.fromProps({ - name: 'proxy', - callback: runProxyCallback, - returns: 'current proxy', - namedArgumentList: [], - unnamedArgumentList: [ - SlashCommandArgument.fromProps({ - description: 'name', - typeList: [ARGUMENT_TYPE.STRING], - isRequired: true, - enumProvider: () => proxies.map(preset => new SlashCommandEnumValue(preset.name, preset.url)), - }), - ], - helpString: 'Sets a proxy preset by name.', -})); - +export function initOpenai() { + SlashCommandParser.addCommandObject(SlashCommand.fromProps({ + name: 'proxy', + callback: runProxyCallback, + returns: 'current proxy', + namedArgumentList: [], + unnamedArgumentList: [ + SlashCommandArgument.fromProps({ + description: 'name', + typeList: [ARGUMENT_TYPE.STRING], + isRequired: true, + enumProvider: () => proxies.map(preset => new SlashCommandEnumValue(preset.name, preset.url)), + }), + ], + helpString: 'Sets a proxy preset by name.', + })); +} $(document).ready(async function () { $('#test_api_button').on('click', testApiConnection);