From b374d8a7df46448a1d6ec6de71435610f3501659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E9=94=8B0668000834?= Date: Tue, 7 Apr 2026 14:22:20 +0800 Subject: [PATCH] fix(config): allow GetModelConfig to match by model id when model name fails (fixes #2286) --- pkg/config/config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 7165246e5..db9855eb2 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1207,7 +1207,7 @@ func (c *Config) GetModelConfig(modelName string) (*ModelConfig, error) { return matches[idx], nil } -// findMatches finds all ModelConfig entries with the given model_name. +// findMatches finds all ModelConfig entries with the given model_name or model id. func (c *Config) findMatches(modelName string) []*ModelConfig { var matches []*ModelConfig for i := range c.ModelList { @@ -1215,6 +1215,14 @@ func (c *Config) findMatches(modelName string) []*ModelConfig { matches = append(matches, c.ModelList[i]) } } + // If no matches found, also try matching by model id (e.g., "openai/gpt-4o") + if len(matches) == 0 { + for i := range c.ModelList { + if c.ModelList[i].Model == modelName { + matches = append(matches, c.ModelList[i]) + } + } + } return matches }