Bug Description
The /model provider picker lists the same provider three times when it is defined in the providers: section of config.yaml. For example, a provider named NVIDIA appears as NVIDIA (2), NVIDIA (1), and Nvidia (0). This creates a misleading and cluttered UI.
Steps to Reproduce
-
In config.yaml, define a provider under the providers: section:
providers:
NVIDIA:
name: "NVIDIA"
api: "https://integrate.api.nvidia.com/v1"
models:
- "model-1"
- "model-2"
-
Ensure the custom_providers list is empty: custom_providers: [].
-
Start the Hermes Agent Gateway.
-
Execute the /model command in the messaging platform (e.g., Telegram).
-
Observe that NVIDIA is listed three times with different model counts.
Expected Behavior
The /model picker should only show one single entry per provider. Regardless of whether the provider is a built-in one from models.dev, a user-defined one in providers:, or a legacy custom_providers entry, the system should deduplicate them using a consistent, case-insensitive identifier (slug). The entry shown should prioritize the most complete definition (i.e., the one with the full models list).
Actual Behavior
The provider is listed three times due to inconsistent slugging and missing deduplication across different loading sections:
- Nvidia (0): Loaded from PROVIDER_TO_MODELS_DEV (Built-in) with slug "nvidia".
- NVIDIA (2): Loaded from providers: config (User-defined) with slug "NVIDIA".
- NVIDIA (1): Loaded from the compatibility view via get_compatible_custom_providers with slug "custom:nvidia".
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
Telegram
Debug Report
Report https://paste.rs/fxoLg
agent.log https://paste.rs/2RZ9l
gateway.log https://paste.rs/gBloB
Operating System
Ubuntu 24.04
Python Version
3.11.15
Hermes Version
0.9.0
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
The bug is in hermes_cli/model_switch.py within the list_authenticated_providers function. The duplication occurs because of three overlapping loading paths with inconsistent slugging:
- Path 1 (Built-in): Uses lowercase slugs from PROVIDER_TO_MODELS_DEV (e.g., "nvidia").
- Path 2 (User-defined): Uses the raw key from providers: config (e.g., "NVIDIA"). Crucially, this section fails to check or update the seen_slugs set, allowing subsequent paths to add the same provider again.
- Path 3 (Compatibility View): get_compatible_custom_providers in hermes_cli/config.py converts providers: entries into a legacy list. The slug is then generated via custom_provider_slug(), which adds a "custom:" prefix (e.g., "custom:nvidia").
Because "nvidia" $\neq$ "NVIDIA" $\neq$ "custom:nvidia", the deduplication logic fails completely, and all three entries are appended to the results.
Proposed Fix (optional)
- Normalize Slugs: Ensure all provider slugs are converted to lowercase before being checked or added to the seen_slugs set.
- Fix Section 3: In hermes_cli/model_switch.py, add the missing seen_slugs check and update inside the user_providers loop:
if ep_name.lower() in seen_slugs:
continue
... (append to results) ...
seen_slugs.add(ep_name.lower())
- Unify Compatibility Slugs: Ensure that the compatibility layer does not introduce redundant prefixes (like custom:) when the provider is already defined in the primary providers: section.
Are you willing to submit a PR for this?
Bug Description
The /model provider picker lists the same provider three times when it is defined in the providers: section of config.yaml. For example, a provider named NVIDIA appears as NVIDIA (2), NVIDIA (1), and Nvidia (0). This creates a misleading and cluttered UI.
Steps to Reproduce
In config.yaml, define a provider under the providers: section:
providers:
NVIDIA:
name: "NVIDIA"
api: "https://integrate.api.nvidia.com/v1"
models:
- "model-1"
- "model-2"
Ensure the custom_providers list is empty: custom_providers: [].
Start the Hermes Agent Gateway.
Execute the /model command in the messaging platform (e.g., Telegram).
Observe that NVIDIA is listed three times with different model counts.
Expected Behavior
The /model picker should only show one single entry per provider. Regardless of whether the provider is a built-in one from models.dev, a user-defined one in providers:, or a legacy custom_providers entry, the system should deduplicate them using a consistent, case-insensitive identifier (slug). The entry shown should prioritize the most complete definition (i.e., the one with the full models list).
Actual Behavior
The provider is listed three times due to inconsistent slugging and missing deduplication across different loading sections:
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
Telegram
Debug Report
Operating System
Ubuntu 24.04
Python Version
3.11.15
Hermes Version
0.9.0
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
The bug is in hermes_cli/model_switch.py within the list_authenticated_providers function. The duplication occurs because of three overlapping loading paths with inconsistent slugging:
Because "nvidia"$\neq$ "NVIDIA" $\neq$ "custom:nvidia", the deduplication logic fails completely, and all three entries are appended to the results.
Proposed Fix (optional)
Are you willing to submit a PR for this?