From 2805a684a891a94be68bd3a9143f9baafac9d8ba Mon Sep 17 00:00:00 2001 From: maver Date: Sat, 5 Aug 2023 18:23:28 +0200 Subject: [PATCH] Emit events on changing chatcompletion source or model --- public/script.js | 2 ++ public/scripts/openai.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/public/script.js b/public/script.js index 00c8909e3..f8b00d02e 100644 --- a/public/script.js +++ b/public/script.js @@ -257,6 +257,8 @@ export const event_types = { MOVABLE_PANELS_RESET: 'movable_panels_reset', SETTINGS_LOADED_BEFORE: 'settings_loaded_before', SETTINGS_LOADED_AFTER: 'settings_loaded_after', + CHATCOMPLETION_SOURCE_CHANGED: 'chatcompletion_source_changed', + CHATCOMPLETION_MODEL_CHANGED: 'chatcompletion_model_changed', OAI_BEFORE_CHATCOMPLETION: 'oai_before_chatcompletion', OAI_PRESET_CHANGED: 'oai_preset_changed', WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated', diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 28a415521..7218885fd 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -2585,6 +2585,7 @@ async function onModelChange() { } saveSettingsDebounced(); + eventSource.emit(event_types.CHATCOMPLETION_MODEL_CHANGED, value); } async function onNewPresetClick() { @@ -2918,6 +2919,8 @@ $(document).ready(function () { if (main_api == 'openai') { reconnectOpenAi(); } + + eventSource.emit(event_types.CHATCOMPLETION_SOURCE_CHANGED, oai_settings.chat_completion_source); }); $('#oai_max_context_unlocked').on('input', function () {