diff --git a/static/ui.js b/static/ui.js index 4ddfebac..e6a5b8b2 100644 --- a/static/ui.js +++ b/static/ui.js @@ -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; diff --git a/tests/test_issue5989_custom_proxy_picker_dedup.py b/tests/test_issue5989_custom_proxy_picker_dedup.py index 8418933c..0b6a1550 100644 --- a/tests/test_issue5989_custom_proxy_picker_dedup.py +++ b/tests/test_issue5989_custom_proxy_picker_dedup.py @@ -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"]],