feat: support models dict format in custom_providers#532
feat: support models dict format in custom_providers#532happy5318 wants to merge 1 commit intonesquena:masterfrom
Conversation
Review: feat — support
|
eec84e8 to
7b2717e
Compare
- Parse 'models' dict format: {model-name: {context_length: ...}}
- Parse 'models' list format: [model-name1, model-name2, ...]
- Each custom provider displays as separate group in dropdown
- Fix duplicate 'Custom' group when active_provider is 'custom:xxx'
- Fix cross-provider deduplication bug (same model in different providers)
- Maintain backward compatibility with single 'model' field format
7b2717e to
cdc1ded
Compare
Agent Review — HOLD 🔶Thank you @happy5318 for this feature — supporting a Three items to address before this can merge: 1. Missing tests (required)No tests were added for the new dict format path. Please add tests to a) Dict format routes correctly: def test_custom_provider_models_dict_routing():
# @provider:model emitted by dropdown resolves to correct base_url
# model-a from 'Local Ollama' provider returns base_url='http://localhost:11434/v1'b) Multiple providers don't cross-route: def test_custom_provider_multiple_no_cross_routing():
# @provider-two:model-b should return base_url of provider-two, not provider-onec) Each provider gets its own display group: def test_get_available_models_dict_format_groups():
# Two custom_providers entries → two separate 'Custom:ProviderName' groups in the dropdown2. Double group regression (required fix)Users who have both a configured external provider and Root cause: the condition that discards 3.
|
Summary
This PR adds support for the
modelsdict format incustom_providersconfiguration, which is used by Hermes Agent to define multiple models per custom provider.Problem
Currently, the WebUI only supports the single
modelfield format incustom_providers:But Hermes Agent also supports a
modelsdict format for defining multiple models:Solution
model(single) andmodels(dict) formatsactive_provideris incustom:xxxformatChanges
get_available_models()inapi/config.py_custom_provider_modelsdict to collect models per providercustom:xxxproviders in the main loop (avoid duplicates)Testing
Verified with a config containing multiple custom providers with 20+ models total, all displayed correctly in the WebUI model dropdown.
Backward Compatibility
✅ Maintains full backward compatibility with the single
modelfield format