fix: show custom_providers models regardless of active provider (#515 #519)

When a user has custom_providers configured in config.yaml, their custom
models should appear in the model picker even if active_provider is set
to a different provider (e.g. openrouter). Previously, the custom provider
was always discarded from detected_providers when active_provider != 'custom',
making custom models invisible.

Fix: only discard 'custom' if there are no custom_providers entries.

Co-authored-by: cloudyun888 <cloudyun888@users.noreply.github.com>
Co-authored-by: shruggr <shruggr@users.noreply.github.com>
This commit is contained in:
Hermes Agent
2026-04-15 07:42:12 +00:00
parent eb760a2158
commit 7ea7331f26

View File

@@ -949,8 +949,11 @@ def get_available_models() -> dict:
# THAT provider, not to a separate "Custom" group. hermes_cli reports
# 'custom' as authenticated whenever base_url is set, which would otherwise
# build a phantom "Custom" bucket next to the real provider's group. Drop
# it unless the user explicitly chose 'custom' as their active provider.
if active_provider and active_provider != "custom":
# it unless (a) the user explicitly chose 'custom' as their active provider,
# or (b) the user has custom_providers entries in config.yaml (those models
# were already added above and should still be shown).
_has_custom_providers = isinstance(_custom_providers_cfg, list) and len(_custom_providers_cfg) > 0
if active_provider and active_provider != "custom" and not _has_custom_providers:
detected_providers.discard("custom")
# 5. Build model groups