From 719be1ebb37b884c119a5f70f0ceac61e15f5444 Mon Sep 17 00:00:00 2001 From: ellvix Date: Wed, 3 Apr 2024 09:31:27 -0600 Subject: [PATCH] fix: LLM now properly reset on any setting change (#465) --- src/js/constants.js | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/js/constants.js b/src/js/constants.js index 310e3f39..a985aa83 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -389,7 +389,9 @@ class Menu { Open GenAI Chat ${ - constants.isMac ? constants.alt : constants.control + constants.isMac + ? constants.alt + : constants.control } + Shift + ? @@ -605,13 +607,22 @@ class Menu { // trigger notification that LLM will be reset // this is done on change of LLM model, multi settings, or skill level - constants.events.push([ - document.getElementById('LLM_model'), - 'change', - function (e) { - menu.NotifyOfLLMReset(); - }, - ]); + let LLMResetIds = [ + 'LLM_model', + 'openai_multi', + 'gemini_multi', + 'skill_level', + 'LLM_preferences', + ]; + for (let i = 0; i < LLMResetIds.length; i++) { + constants.events.push([ + document.getElementById(LLMResetIds[i]), + 'change', + function (e) { + menu.NotifyOfLLMReset(); + }, + ]); + } } /** @@ -855,6 +866,13 @@ class Menu { ) { shouldReset = true; } + if ( + !shouldReset && + constants.LLMPreferences != + document.getElementById('LLM_preferences').value + ) { + shouldReset = true; + } if ( !shouldReset && constants.LLMModel != document.getElementById('LLM_model').value @@ -1029,7 +1047,7 @@ class ChatLLM { document, 'keyup', function (e) { - if (e.key == '?' && (e.ctrlKey || e.metaKey) || e.key == '¿') { + if ((e.key == '?' && (e.ctrlKey || e.metaKey)) || e.key == '¿') { chatLLM.Toggle(); } },