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:
@@ -949,8 +949,11 @@ def get_available_models() -> dict:
|
|||||||
# THAT provider, not to a separate "Custom" group. hermes_cli reports
|
# THAT provider, not to a separate "Custom" group. hermes_cli reports
|
||||||
# 'custom' as authenticated whenever base_url is set, which would otherwise
|
# 'custom' as authenticated whenever base_url is set, which would otherwise
|
||||||
# build a phantom "Custom" bucket next to the real provider's group. Drop
|
# build a phantom "Custom" bucket next to the real provider's group. Drop
|
||||||
# it unless the user explicitly chose 'custom' as their active provider.
|
# it unless (a) the user explicitly chose 'custom' as their active provider,
|
||||||
if active_provider and active_provider != "custom":
|
# 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")
|
detected_providers.discard("custom")
|
||||||
|
|
||||||
# 5. Build model groups
|
# 5. Build model groups
|
||||||
|
|||||||
Reference in New Issue
Block a user