From 4f109aebbe2c72b9201959952cbaebec42599834 Mon Sep 17 00:00:00 2001 From: webtecnica Date: Thu, 10 Sep 2026 22:31:51 -0300 Subject: [PATCH] fix(settings): preserve configured aux provider when absent from catalog (#7486) --- static/panels.js | 13 +- tests/test_auxiliary_models_settings.py | 274 ++++++++++++++++++++++++ 2 files changed, 286 insertions(+), 1 deletion(-) diff --git a/static/panels.js b/static/panels.js index c33bcdce..29e11344 100644 --- a/static/panels.js +++ b/static/panels.js @@ -12315,12 +12315,23 @@ function _buildAuxProviderOptions(sel,providers,currentProvider){ autoOpt.value='auto';autoOpt.textContent='auto ('+t('settings_aux_provider_auto')+')'; if(currentProvider==='auto'||!currentProvider) autoOpt.selected=true; sel.appendChild(autoOpt); + let matched=currentProvider==='auto'||!currentProvider; for(const p of providers){ const opt=document.createElement('option'); opt.value=p.slug;opt.textContent=p.name; - if(p.slug===currentProvider) opt.selected=true; + if(p.slug===currentProvider){opt.selected=true;matched=true;} sel.appendChild(opt); } + // The configured provider can be absent from the /api/models catalog (e.g. its + // group exposes no models). Keep it selectable: with no matching option the + // select falls back to its first entry ('auto') and the next Apply would + // persist that, silently discarding the configured value. + if(!matched&¤tProvider){ + const configuredOpt=document.createElement('option'); + configuredOpt.value=currentProvider;configuredOpt.textContent=currentProvider+' (configured)'; + configuredOpt.selected=true; + sel.appendChild(configuredOpt); + } } function _buildAuxModelOptions(sel,provider,providers,currentModel){ diff --git a/tests/test_auxiliary_models_settings.py b/tests/test_auxiliary_models_settings.py index 98c73579..513377ee 100644 --- a/tests/test_auxiliary_models_settings.py +++ b/tests/test_auxiliary_models_settings.py @@ -312,6 +312,280 @@ console.log(JSON.stringify({ "Missing _buildAuxModelOptions() for model dropdown rebuild" ) + @pytest.mark.skipif(NODE is None, reason="node not on PATH") + def test_configured_aux_provider_absent_from_catalog_is_preserved(self): + """#7486: a configured provider missing from /api/models must survive Apply. + + The aux provider /