File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,21 @@ import (
1818func CreateProvider (cfg * config.Config ) (LLMProvider , string , error ) {
1919 model := cfg .Agents .Defaults .GetModelName ()
2020
21- // Ensure model_list is populated (should be done by LoadConfig, but handle edge cases)
22- if len (cfg .ModelList ) == 0 && cfg .HasProvidersConfig () {
23- cfg .ModelList = config .ConvertProvidersToModelList (cfg )
21+ // Ensure model_list is populated from providers config if needed
22+ // This handles two cases:
23+ // 1. ModelList is empty - convert all providers
24+ // 2. ModelList has some entries but not all providers - merge missing ones
25+ if cfg .HasProvidersConfig () {
26+ providerModels := config .ConvertProvidersToModelList (cfg )
27+ existingModelNames := make (map [string ]bool )
28+ for _ , m := range cfg .ModelList {
29+ existingModelNames [m .ModelName ] = true
30+ }
31+ for _ , pm := range providerModels {
32+ if ! existingModelNames [pm .ModelName ] {
33+ cfg .ModelList = append (cfg .ModelList , pm )
34+ }
35+ }
2436 }
2537
2638 // Must have model_list at this point
You can’t perform that action at this time.
0 commit comments