fix: guard localStorage.setItem('hermes-webui-model') against QuotaExceededError
On some setups the localStorage quota is exhausted; the bare setItem call throws an unhandled DOMException that breaks model selection and prevents the chat UI from loading. Wrap both call-sites (boot.js model-select onChange, onboarding.js _saveOnboardingDefaults) in try/catch so the error is logged to the console as a warning instead of surfacing as a fatal exception. Fixes: 'Failed to execute setItem on Storage: Setting the value of hermes-webui-model exceeded the quota.'
This commit is contained in:
parent
cebca4700b
commit
9a0a6214cf
2 changed files with 2 additions and 2 deletions
|
|
@ -815,7 +815,7 @@ $('modelSelect').onchange=async()=>{
|
|||
: {model:selectedModel,model_provider:null};
|
||||
if(typeof closeModelDropdown==='function') closeModelDropdown();
|
||||
if(typeof _writePersistedModelState==='function') _writePersistedModelState(modelState.model,modelState.model_provider);
|
||||
else localStorage.setItem('hermes-webui-model', modelState.model);
|
||||
else try{localStorage.setItem('hermes-webui-model',modelState.model)}catch{}
|
||||
await api('/api/session/update',{method:'POST',body:JSON.stringify({
|
||||
session_id:S.session.session_id,
|
||||
workspace:S.session.workspace,
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ async function _saveOnboardingDefaults(){
|
|||
if(ONBOARDING.status){
|
||||
ONBOARDING.status.settings={...(ONBOARDING.status.settings||{}),password_enabled:!!saved.auth_enabled};
|
||||
}
|
||||
localStorage.setItem('hermes-webui-model',model);
|
||||
try{localStorage.setItem('hermes-webui-model',model)}catch{}
|
||||
if($('modelSelect')) _applyModelToDropdown(model,$('modelSelect'));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue