mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 11:10:18 +00:00
a958c29373
Two bugs in get_available_models() conspired to duplicate the active provider's auto-detected models under a phantom 'Custom' group whenever custom_providers was also declared in config.yaml: 1. custom:* PIDs not in _named_custom_groups (e.g. stale slugs left from prior configs) fell through to the auto_detected_models fallback, copying the active provider's whole catalog into a phantom Custom: <slug> group. Fix: continue unconditionally for ANY custom:* PID — the named-group branch is the only legitimate population path. 2. The bare 'custom' PID, with the active provider being concrete (e.g. ai-gateway), hit 'elif auto_detected_models: copy.deepcopy(...)' and built a duplicate Custom group of the active provider's models with mismatched provider prefixes. Fix: when pid == 'custom' and the active provider is non-custom, leave models_for_group empty. The reporter also suggested a third fix gating resolve_model_provider() on config_provider — that's intentionally NOT applied because it conflicts with the long-standing model-specific-override semantics covered by test_model_resolver.py::test_custom_provider_*_routes_to_named_custom_provider (custom_providers entries explicitly override the active provider's routing when the user opted-in). The reporter's symptom (duplicate UI group) lives entirely in get_available_models()'s group construction and is fully fixed by the two changes above. Tests: 6 new regression tests (3 in #1881 file + reuse), 774 broader tests still green (model/provider/custom/config domain).