feat(registry): add client model support check for executor filtering

- Introduced `ClientSupportsModel` function to `ModelRegistry` for verifying client support for specific models.
- Integrated model support validation into executor candidate filtering logic.
- Updated CLIProxy registry interface to include the new support check method.
This commit is contained in:
Luis Pater
2025-10-31 09:15:14 +08:00
parent af3fbd134d
commit 07da781336
3 changed files with 31 additions and 0 deletions

View File

@@ -841,6 +841,8 @@ func (m *Manager) pickNext(ctx context.Context, provider, model string, opts cli
return nil, nil, &Error{Code: "executor_not_found", Message: "executor not registered"}
}
candidates := make([]*Auth, 0, len(m.auths))
modelKey := strings.TrimSpace(model)
registryRef := registry.GetGlobalRegistry()
for _, candidate := range m.auths {
if candidate.Provider != provider || candidate.Disabled {
continue
@@ -848,6 +850,9 @@ func (m *Manager) pickNext(ctx context.Context, provider, model string, opts cli
if _, used := tried[candidate.ID]; used {
continue
}
if modelKey != "" && registryRef != nil && !registryRef.ClientSupportsModel(candidate.ID, modelKey) {
continue
}
candidates = append(candidates, candidate)
}
if len(candidates) == 0 {