fix(model): split comma-separated fallback chains into picker entries
Providers like the volcengine agent plans declare `default_model` (or a custom provider's `model:`) as a comma-separated fallback chain. The picker absorbed it as one opaque id, so the Desktop model switcher showed the whole chain as a single entry and every selection sent the full string as the model field, leaving routing to the server. Fold the split into `_absorb_entry_models` — the chokepoint both `providers:` (section 3) and `custom_providers:` (section 4) flow through — so every absorbed entry keeps `_declared_model_ids`' list-of-dict handling while comma chains expand into individually selectable ids. The raw chain stays first so the server-side fallback behaviour itself remains the default pick. Fixes https://github.com/NousResearch/hermes-agent/issues/50557
This commit is contained in:
committed by
brooklyn!
parent
cd3f453f3e
commit
f2eb98feae
@@ -521,6 +521,16 @@ def _absorb_entry_models(grp: dict, entry: dict, active_model: Any) -> None:
|
||||
if _models_config_is_allowlist(models_field, _entry_models_discovered(entry)):
|
||||
grp["has_explicit_models"] = True
|
||||
_extend_unique(grp["models"], _declared_model_ids(models_field))
|
||||
_split_chain_entries(grp["models"])
|
||||
|
||||
|
||||
def _split_chain_entries(models: list) -> None:
|
||||
"""Split comma-separated fallback chains (``default_model: a,b,c`` — e.g. the volcengine
|
||||
agent plans) into individually selectable ids. The raw chain stays first so the server-side
|
||||
fallback behaviour itself remains the default pick; the split ids follow it. Fixes #50557."""
|
||||
for model in list(models):
|
||||
if isinstance(model, str) and "," in model:
|
||||
_extend_unique(models, [part.strip() for part in model.split(",")])
|
||||
|
||||
|
||||
def _extend_unique(target: list, items) -> None:
|
||||
|
||||
Reference in New Issue
Block a user