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.
This commit is contained in:
parent
8a1fb03974
commit
c1b0621402
2 changed files with 10 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue