mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 11:10:18 +00:00
9b1d786459
Move the `_PORTAL_PROVIDERS` guard in `resolve_model_provider()` to run BEFORE the `prefix == config_provider` strip branch. The guard was added for NVIDIA (along with the Nous portal cases in #854 / #894) but was placed after the strip, so it never fired when `config_provider == "nvidia"` and the model id started with `nvidia/`. For `model_id="nvidia/nemotron-3-super-120b-a12b"`, `config_provider="nvidia"`: - prefix = "nvidia", bare = "nemotron-3-super-120b-a12b" - prefix == config_provider → True → strip branch returned bare name - `_PORTAL_PROVIDERS` guard never reached - bare "nemotron-3-super-120b-a12b" sent to NVIDIA NIM → HTTP 404 NIM requires the full namespaced path. The fix moves the portal guard to run first, so all portal providers (Nous, OpenCode-Zen, OpenCode-Go, NVIDIA NIM) always preserve the full `provider/model` id regardless of whether the prefix happens to equal the provider name. This also closes a latent symmetric bug for the Nous case if a `nous/<model>` id ever existed in the catalog. Test plan: - New `tests/test_issue2177_nvidia_prefix_preservation.py` covers: - nvidia/nemotron-... under nvidia (the reported case) - cross-namespace qwen/ and meta/ under nvidia (regression pin) - every static nvidia model in `_PROVIDER_MODELS` resolves to itself - latent nous/<model> under nous (structural ordering pin) - non-portal providers (anthropic) still strip — fix doesn't over-correct - Existing portal-routing suites (test_nous_portal_routing.py, test_issue895_894_nous_prefix.py) continue to pass. - Full test suite: 5320 passed, 4 skipped, 3 xpassed. Reported on Discord by @vishnu (Nathan forwarded as #2177).