fix: FindModel reverse fuzzy match for date-suffixed model IDs
Add step between exact ID match and forward fuzzy match that checks if registry model ID starts with the requested name. Fixes models like 'gpt-5.4-mini' not matching 'gpt-5.4-mini-2026-04-01' in registry.
This commit is contained in:
@@ -56,7 +56,16 @@ func (r *ModelRegistry) FindModel(modelID string) *ModelMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
// Try fuzzy matching (e.g. gpt-4o-2024-05-13 matching gpt-4o)
|
||||
// Try reverse fuzzy matching (e.g. 'gpt-5.4-mini' matching 'gpt-5.4-mini-2026-04-01')
|
||||
for _, provider := range r.Providers {
|
||||
for id, model := range provider.Models {
|
||||
if strings.HasPrefix(id, modelID) {
|
||||
return &model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try fuzzy matching (e.g. 'gpt-4o-2024-05-13' matching 'gpt-4o')
|
||||
for _, provider := range r.Providers {
|
||||
for id, model := range provider.Models {
|
||||
if strings.HasPrefix(modelID, id) {
|
||||
|
||||
Reference in New Issue
Block a user