fix: show toast when model is switched during active session (#419)
When a user switches the model via the model picker while a session has existing messages, a toast now informs them: 'Model change takes effect in your next conversation'. This prevents confusion when the model dropdown updates visually but the running conversation continues with the original model. Implementation: 4-line addition in modelSelect.onchange in boot.js, after the existing provider-mismatch warning. Checks S.messages.length (the reliable in-memory array) and guards showToast with typeof. Synthesized from PRs #516 (armorbreak001), #517 and #518 (cloudyun888). Placement follows #518's correct boot.js approach. Reference corrected from S.session.messages to S.messages (always initialized by loadSession). 4 new tests in test_provider_mismatch.py::TestModelSwitchToast. Co-authored-by: armorbreak001 <armorbreak001@users.noreply.github.com> Co-authored-by: cloudyun888 <cloudyun888@users.noreply.github.com>
This commit is contained in:
@@ -420,6 +420,10 @@ $('modelSelect').onchange=async()=>{
|
||||
const warn=_checkProviderMismatch(selectedModel);
|
||||
if(warn&&typeof showToast==='function') showToast(warn,4000);
|
||||
}
|
||||
// Notify user that model changes only take effect in the next conversation (#419)
|
||||
if(S.messages && S.messages.length > 0 && typeof showToast==='function'){
|
||||
showToast('Model change takes effect in your next conversation', 3000);
|
||||
}
|
||||
};
|
||||
$('msg').addEventListener('input',()=>{
|
||||
autoResize();
|
||||
|
||||
Reference in New Issue
Block a user