Skip to content

feat(model-picker): group custom_providers by name into a single row per provider#8011

Closed
akhater wants to merge 1 commit into
NousResearch:mainfrom
akhater:feat/model-picker-group-custom-providers
Closed

feat(model-picker): group custom_providers by name into a single row per provider#8011
akhater wants to merge 1 commit into
NousResearch:mainfrom
akhater:feat/model-picker-group-custom-providers

Conversation

@akhater

@akhater akhater commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Summary

The /model picker currently renders one row per custom_providers entry. When several entries share the same provider name (e.g. four ollama-cloud entries for qwen3-coder, glm-5.1, kimi-k2, minimax-m2.7), users see four separate ""Ollama Cloud"" rows in the picker, which is confusing UX — there is only one Ollama Cloud provider, so there should be one row containing four models.

This PR groups custom_providers entries that share the same provider name into a single picker row, while keeping entries with distinct names as separate rows.

Before

```
custom_providers:

picker:

```

  1. Ollama Cloud qwen3-coder:480b-cloud
  2. Ollama Cloud glm-5.1:cloud
  3. Ollama Cloud kimi-k2.5
  4. Ollama Cloud minimax-m2.7:cloud
  5. Moonshot kimi-k2-thinking
    ```

After

```

  1. Ollama Cloud qwen3-coder:480b-cloud, glm-5.1:cloud, kimi-k2.5, minimax-m2.7:cloud
  2. Moonshot kimi-k2-thinking
    ```

Each provider gets one row, and the picker drills into the model list when the user selects it — same as the curated providers (Anthropic, OpenAI, etc.) already do.

Implementation

Replaces the single-pass loop in list_authenticated_providers() (hermes_cli/model_switch.py) with a two-pass approach:

  1. First pass: build an OrderedDict keyed by custom_provider_slug(name), accumulating models per group while preserving discovery order.
  2. Second pass: iterate the groups and append one result row per group, skipping any slug that already appeared in an earlier provider source (the existing seen_slugs guard is preserved).

Insertion order is preserved via OrderedDict, so providers and their models still appear in the order the user listed them in custom_providers. No new dependencies.

What's preserved

  • seen_slugs skip logic — providers already registered by an earlier source (curated providers, user-defined endpoints) still take precedence over custom_providers entries with the same slug.
  • The not display_name or not api_url skip — entries missing either field are still ignored.
  • All field parsingbase_url / url / api precedence is unchanged.
  • The sort ordercurrent provider first, then by model count descending still applies, so the user's active provider always floats to the top and the grouped row's higher total_models correctly reflects the new behaviour.

Files

  • hermes_cli/model_switch.py — single function (list_authenticated_providers), 25 inserted / 10 removed.

Test plan

  • Manual run of /model against a config with multiple Ollama Cloud entries shows one grouped row instead of four duplicates.
  • Distinct provider names (Ollama Cloud + Moonshot) still produce separate rows.
  • Insertion order is preserved across both passes.
  • Existing seen_slugs precedence still applies — custom_providers entries do not override curated providers with the same slug.
  • Syntax + import smoke test (ast.parse + from hermes_cli.model_switch import list_authenticated_providers).
  • Happy to add a unit test against list_authenticated_providers if reviewers want one before merge — the function is pure (config in, list out), so a test against a synthetic config dict is straightforward.

Related PRs

This builds naturally on top of #7261 (custom_providers list schema support) and #7267 (hide providers with no curated LLM models). Both are still open. This PR does not depend on either being merged first — it stands alone against current main.

🤖 Generated with Claude Code

…per provider

The /model picker currently renders one row per ``custom_providers``
entry. When several entries share the same provider name (e.g. four
``ollama-cloud`` entries for ``qwen3-coder``, ``glm-5.1``, ``kimi-k2``,
``minimax-m2.7``), users see four separate "Ollama Cloud" rows in the
picker, which is confusing UX — there is only one Ollama Cloud
provider, so there should be one row containing four models.

This PR groups ``custom_providers`` entries that share the same provider
name into a single picker row while keeping entries with distinct names
as separate rows. So:

* Four entries named ``Ollama Cloud`` → one "Ollama Cloud" row with
  four models inside.
* One entry named ``Ollama Cloud`` and one named ``Moonshot`` → two
  separate rows, one model each.

Implementation
--------------
Replaces the single-pass loop in ``list_authenticated_providers()`` with
a two-pass approach:

1. First pass: build an ``OrderedDict`` keyed by ``custom_provider_slug(name)``,
   accumulating ``models`` per group while preserving discovery order.
2. Second pass: iterate the groups and append one result row per group,
   skipping any slug that already appeared in an earlier provider source
   (the existing ``seen_slugs`` guard).

Insertion order is preserved via ``OrderedDict``, so providers and
their models still appear in the order the user listed them in
``custom_providers``. No new dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
teknium1 added a commit that referenced this pull request Apr 13, 2026
teknium1 added a commit that referenced this pull request Apr 13, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #9275. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @akhater!

ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
@akhater akhater deleted the feat/model-picker-group-custom-providers branch May 1, 2026 17:59
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants