fix(#5989): keep cross-provider live rows selectable

This commit is contained in:
Rod Boev 2026-07-13 01:35:13 -04:00 committed by nesquena-hermes
parent 58725d5de9
commit ff89f2ebd6
2 changed files with 16 additions and 3 deletions

View file

@ -3418,9 +3418,11 @@ function _addLiveModelsToSelect(provider, models, sel){
const identity=optionIdentity(mid);
if(hasExistingNorm(identity)){
const sameGroup=Array.from(providerGroup.children||[]).find(o=>optionIdentity(o.value)===identity);
const incomingRoutable=String(mid).startsWith('@');
const existingRoutable=sameGroup&&String(sameGroup.value||'').startsWith('@');
if(!(sameGroup&&!existingRoutable&&incomingRoutable)) continue; // let proxy replace catalog twin
if(sameGroup){
const incomingRoutable=String(mid).startsWith('@');
const existingRoutable=String(sameGroup.value||'').startsWith('@');
if(!(!existingRoutable&&incomingRoutable)) continue; // let proxy replace catalog twin
}
}
const opt=document.createElement('option');
opt.value=mid;

View file

@ -87,6 +87,9 @@ const sameSuffix=makeSelect();
addCatalog(sameSuffix,'vendor-a/deepseek-v4-pro');
addCatalog(sameSuffix,'vendor-b/catalog/deepseek-v4-pro');
sameSuffix.value='vendor-a/deepseek-v4-pro';
const crossProviderLive=new Node('select');
_addLiveModelsToSelect('custom:a',[{{id:'@custom:a:gpt-4o',label:'GPT-4o A'}}],crossProviderLive);
_addLiveModelsToSelect('custom:b',[{{id:'@custom:b:gpt-4o',label:'GPT-4o B'}}],crossProviderLive);
const unnamespaced=makeSelect();
addCatalog(unnamespaced,'gpt-4o');
_addLiveModelsToSelect('custom:llm-proxy',[{{id:'@custom:llm-proxy:gpt-4o',label:'GPT-4o'}}],unnamespaced);
@ -95,6 +98,7 @@ console.log(JSON.stringify({{
catalogFirst:snapshot(catalogFirst),
selectedBare:snapshot(selectedBare),
sameSuffix:snapshot(sameSuffix),
crossProviderLive:snapshot(crossProviderLive),
unnamespaced:snapshot(unnamespaced),
}}));
"""
@ -132,6 +136,13 @@ def test_same_suffix_models_in_one_group_do_not_collapse():
}
def test_live_models_with_same_identity_survive_in_different_provider_groups():
assert _run_harness()["crossProviderLive"] == {
"groups": [["@custom:a:gpt-4o"], ["@custom:b:gpt-4o"]],
"selected": "@custom:a:gpt-4o",
}
def test_unnamespaced_custom_proxy_value_deduplicates_with_catalog():
assert _run_harness()["unnamespaced"] == {
"groups": [["@custom:llm-proxy:gpt-4o"]],