Skip to content

Commit

Permalink
fix: LLM now properly reset on any setting change (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix authored Apr 3, 2024
1 parent c83fd01 commit 719be1e
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions src/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ class Menu {
<tr>
<td>Open GenAI Chat</td>
<td>${
constants.isMac ? constants.alt : constants.control
constants.isMac
? constants.alt
: constants.control
} + Shift + ?</td>
</tr>
<tr>
Expand Down Expand Up @@ -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();
},
]);
}
}

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
},
Expand Down

0 comments on commit 719be1e

Please sign in to comment.