Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add notification to settings that will reset LLM chat history #428

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class Menu {
</div>
</div>
<div class="modal-footer">
<button type="button" id="save_and_close_menu">Save and Close</button>
<button type="button" id="save_and_close_menu" aria-labelledby="save_and_close_text"><span id="save_and_close_text">Save and Close</span></button>
<button type="button" id="close_menu">Close</button>
</div>
</div>
Expand Down Expand Up @@ -579,6 +579,16 @@ 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();
},
]);
}

/**
Expand Down Expand Up @@ -720,6 +730,9 @@ class Menu {
document.getElementById('LLM_preferences').value =
constants.LLMPreferences;
}
if (document.getElementById('LLM_reset_notification')) {
document.getElementById('LLM_reset_notification').remove();
}
}

/**
Expand Down Expand Up @@ -777,6 +790,24 @@ class Menu {
.setAttribute('aria-live', constants.ariaMode);
}

/**
* Notifies the user that the LLM will be reset.
*/
NotifyOfLLMReset() {
let html =
'<p id="LLM_reset_notification">Note: Changes in LLM settings will reset any existing conversation.</p>';
document
.getElementById('save_and_close_menu')
.insertAdjacentHTML('beforebegin', html);

// add to aria button text
document
.getElementById('save_and_close_menu')
.setAttribute(
'aria-labelledby',
'save_and_close_text LLM_reset_notification'
);
}
/**
* Handles changes to the LLM model and multi-modal settings.
* We reset if we change the LLM model, multi settings, or skill level.
Expand Down
Loading