fix(#1106): iterate custom_providers[].models dict keys for dropdown population#1111
fix(#1106): iterate custom_providers[].models dict keys for dropdown population#1111bergeouss wants to merge 1 commit intonesquena:masterfrom
Conversation
…ropdown population - After reading singular 'model' field, also iterate 'models' dict keys - Deduplicate: model field value not repeated if also in models dict - Skip non-string keys gracefully - Works for both named and unnamed custom_providers entries - Add 7 regression tests
|
Thanks for this fix! The root cause analysis is accurate — A few notes on the implementation: Logic looks correct. Iterating dict keys and deduplicating against the singular Test coverage is solid — 7 regression tests covering the key edge cases (overlap, empty dict, non-string keys, unnamed providers). The 1 pre-existing test failure in One thing to verify: Does the fix handle the case where Relates to #1105 (SSRF blocking auto-detect) — once both are fixed, local inference servers (llama-swap, vLLM, llama.cpp) should work end-to-end from |
|
Yes — when only the _cp_model = _cp.get("model", "") # returns "" if absent → not added
_cp_models_dict = _cp.get("models") # iterates dict keysThe singular field is optional — if it's missing, Already covered by test |
|
Merged in v0.50.221 via PR #1117. Thank you @bergeouss — great contribution (custom providers models dict)! 🎉 |
1 similar comment
|
Merged in v0.50.221 via PR #1117. Thank you @bergeouss — great contribution (custom providers models dict)! 🎉 |
Thinking Path
custom_providers[].modelsdict (YAML key-value) is parsed but never iterated for dropdown populationmodelfield was read → users with multiple models inmodelsdict see only onecustom_providersis the only fallback but only picks up one modelmodelfield, also iteratemodelsdict keys and add each as a selectable modelWhat Changed
api/config.py:_build_available_models_uncached()now collects model IDs from bothmodel(singular) andmodels(dict) fields incustom_providersentries. Dict keys are deduplicated against the singularmodelfield. Non-string keys are silently skipped.tests/test_issue1106_custom_providers_models.py: 7 regression tests covering dict iteration, no duplicates, overlap handling, empty dict, non-string keys, unnamed providers, and multiple named providers.Why It Matters
Users with local inference servers (llama.cpp, llama-swap, vLLM, TabbyAPI) list their models in
custom_providers[].modelsin config.yaml. Currently only one model appears in the dropdown. After this fix, all models from the dict are available for selection.Verification
pytest tests/test_issue1106_custom_providers_models.py -v— 7/7 passpytest tests/test_custom_provider_display_name.py tests/test_model_resolver.py -v— 26/27 pass (1 pre-existing failure)py_compile api/config.py— OKRisks / Follow-ups
modelsdict values (metadata likecontext_length) are not yet used — could power context length display in dropdown in a future PRModel Used
Closes #1106