From c1b0621402f68699fcab46c7be241e3fc97af4c7 Mon Sep 17 00:00:00 2001 From: Vishnuvardhan Reddy Date: Thu, 26 Feb 2026 13:36:59 +0000 Subject: [PATCH] fix(config): remove hardcoded default model, use first from model_list Previously, DefaultConfig() had Model: "glm-4.7" as a hardcoded default. When users removed model_name from their config, this default was used, causing confusion because: 1. The user had no idea where "glm-4.7" came from 2. Config changes appeared to not be picked up 3. The system tried to use an unconfigured model Changes: 1. Remove hardcoded "glm-4.7" default from DefaultConfig() 2. When model is empty, use the first model_name from model_list 3. Provide clear error message if no models are available This also fixes the issue where config changes weren't being picked up after restart - the user's missing model_name was being replaced with the hardcoded default. Users should now explicitly specify model_name in their config. --- pkg/config/defaults.go | 2 +- pkg/providers/legacy_provider.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/config/defaults.go b/pkg/config/defaults.go index cf799140d..f51b72173 100644 --- a/pkg/config/defaults.go +++ b/pkg/config/defaults.go @@ -13,7 +13,7 @@ func DefaultConfig() *Config { Workspace: "~/.picoclaw/workspace", RestrictToWorkspace: true, Provider: "", - Model: "glm-4.7", + Model: "", // Require explicit model specification MaxTokens: 8192, Temperature: nil, // nil means use provider default MaxToolIterations: 20, diff --git a/pkg/providers/legacy_provider.go b/pkg/providers/legacy_provider.go index 23f137538..b40dbeb6a 100644 --- a/pkg/providers/legacy_provider.go +++ b/pkg/providers/legacy_provider.go @@ -28,6 +28,15 @@ func CreateProvider(cfg *config.Config) (LLMProvider, string, error) { return nil, "", fmt.Errorf("no providers configured. Please add entries to model_list in your config") } + // If no model is specified, use the first model from model_list + if model == "" { + if len(cfg.ModelList) > 0 { + model = cfg.ModelList[0].ModelName + } else { + return nil, "", fmt.Errorf("no model specified and no models in model_list. Please set model_name in agents.defaults or add models to model_list") + } + } + // Get model config from model_list modelCfg, err := cfg.GetModelConfig(model) if err != nil {