mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 11:10:18 +00:00
fix: support list format for custom_providers.models in model dropdown
The get_available_models() function only handled dict-format models
(`{model_id: {}}`) for custom_providers entries, silently dropping
models specified as YAML lists (`[model1, model2]`) or list of dicts
(`[{id: ..., label: ...}]`).
This caused users who define their custom providers with list-format
model declarations to see zero or incomplete model entries in both
Settings → Preferences → Default Model dropdown and the chat
interface model picker.
The fix adds an `elif isinstance(_cp_models_dict, list)` branch with
support for three list sub-formats:
- Plain string list: `models: [m1, m2]`
- Dict list: `models: [{id: m1, label: ...}]`
- Mixed: `models: [m1, {id: m2}]`
Refs: hermes-agent issue where YAML list models were invisible
This commit is contained in:
@@ -3194,6 +3194,16 @@ def get_available_models() -> dict:
|
||||
for _m_id in _cp_models_dict:
|
||||
if isinstance(_m_id, str) and _m_id.strip() and _m_id not in _cp_model_ids:
|
||||
_cp_model_ids.append(_m_id.strip())
|
||||
elif isinstance(_cp_models_dict, list):
|
||||
for _item in _cp_models_dict:
|
||||
if isinstance(_item, str):
|
||||
_mid = _item.strip()
|
||||
if _mid and _mid not in _cp_model_ids:
|
||||
_cp_model_ids.append(_mid)
|
||||
elif isinstance(_item, dict):
|
||||
_mid = str(_item.get("id") or _item.get("model") or _item.get("name") or "").strip()
|
||||
if _mid and _mid not in _cp_model_ids:
|
||||
_cp_model_ids.append(_mid)
|
||||
|
||||
for _cp_model in _cp_model_ids:
|
||||
_dedup_key = f"{_slug}:{_cp_model}" if _slug else _cp_model
|
||||
|
||||
Reference in New Issue
Block a user