diff --git a/api/config.py b/api/config.py index 27de96d2..f8ad2a42 100644 --- a/api/config.py +++ b/api/config.py @@ -2949,7 +2949,7 @@ def get_available_models() -> dict: _custom_providers_cfg = cfg.get("custom_providers", []) _named_custom_groups: dict = {} if isinstance(_custom_providers_cfg, list): - _seen_custom_ids = {m["id"] for m in auto_detected_models} + _seen_custom_ids = set() for _cp in _custom_providers_cfg: if not isinstance(_cp, dict): continue @@ -2970,9 +2970,10 @@ def get_available_models() -> dict: _cp_model_ids.append(_m_id.strip()) for _cp_model in _cp_model_ids: - if _cp_model and _cp_model not in _seen_custom_ids: + _dedup_key = f"{_slug}:{_cp_model}" if _slug else _cp_model + if _cp_model and _dedup_key not in _seen_custom_ids: _cp_label = _get_label_for_model(_cp_model, []) - _seen_custom_ids.add(_cp_model) + _seen_custom_ids.add(_dedup_key) if _slug: detected_providers.add(_slug) _cp_option_id = _cp_model