DisableModel 禁用指定模型
(provider, model string)
| 261 | |
| 262 | // DisableModel 禁用指定模型 |
| 263 | func (m *ModelFallbackManager) DisableModel(provider, model string) error { |
| 264 | modelKey := fmt.Sprintf("%s/%s", provider, model) |
| 265 | |
| 266 | for _, fb := range m.fallbacks { |
| 267 | fbKey := fmt.Sprintf("%s/%s", fb.Config.Provider, fb.Config.Model) |
| 268 | if fbKey == modelKey { |
| 269 | fb.Enabled = false |
| 270 | fallbackLog.Info(context.Background(), "disabled model", map[string]any{"model": modelKey}) |
| 271 | return nil |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | return fmt.Errorf("model not found: %s", modelKey) |
| 276 | } |
| 277 | |
| 278 | // ListModels 列出所有模型及其状态 |
| 279 | func (m *ModelFallbackManager) ListModels() []map[string]any { |