From e45a445ef98922b83abba1e6c48108f1b8d77986 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:22:13 +0300 Subject: [PATCH] Init textgen model selects before loading settings --- public/script.js | 3 ++- public/scripts/textgen-models.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/script.js b/public/script.js index 22745982e..5c3c126dd 100644 --- a/public/script.js +++ b/public/script.js @@ -225,7 +225,7 @@ import { import { getBackgrounds, initBackgrounds, loadBackgroundSettings, background_settings } from './scripts/backgrounds.js'; import { hideLoader, showLoader } from './scripts/loader.js'; import { BulkEditOverlay, CharacterContextMenu } from './scripts/BulkEditOverlay.js'; -import { loadFeatherlessModels, loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels } from './scripts/textgen-models.js'; +import { loadFeatherlessModels, loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels, initTextGenModels } from './scripts/textgen-models.js'; import { appendFileContent, hasPendingFileAttachment, populateFileAttachment, decodeStyleTags, encodeStyleTags, isExternalMediaAllowed, getCurrentEntityId } from './scripts/chats.js'; import { initPresetManager } from './scripts/preset-manager.js'; import { MacrosParser, evaluateMacros, getLastMessageId } from './scripts/macros.js'; @@ -912,6 +912,7 @@ async function firstLoadInit() { await readSecretState(); initLocales(); initDefaultSlashCommands(); + initTextGenModels(); await getSystemMessages(); sendSystemMessage(system_message_types.WELCOME); await getSettings(); diff --git a/public/scripts/textgen-models.js b/public/scripts/textgen-models.js index 3ff4722ef..67a63f372 100644 --- a/public/scripts/textgen-models.js +++ b/public/scripts/textgen-models.js @@ -618,7 +618,7 @@ export function getCurrentDreamGenModelTokenizer() { } } -jQuery(function () { +export function initTextGenModels() { $('#mancer_model').on('change', onMancerModelSelect); $('#model_togetherai_select').on('change', onTogetherModelSelect); $('#model_infermaticai_select').on('change', onInfermaticAIModelSelect); @@ -718,4 +718,4 @@ jQuery(function () { $(this).trigger('change'); }); } -}); +}