(ctx context.Context, auths []*coreauth.Auth)
| 229 | } |
| 230 | |
| 231 | func (s *Service) registerModelsForAuthBatch(ctx context.Context, auths []*coreauth.Auth) { |
| 232 | if s == nil || s.coreManager == nil || len(auths) == 0 { |
| 233 | return |
| 234 | } |
| 235 | tasks := make([]modelRegistrationTask, 0, len(auths)) |
| 236 | for _, auth := range auths { |
| 237 | if auth == nil { |
| 238 | continue |
| 239 | } |
| 240 | authForRegistration := auth.Clone() |
| 241 | tasks = append(tasks, modelRegistrationTask{ |
| 242 | phase: modelRegistrationPhase(authForRegistration), |
| 243 | category: modelRegistrationCategory(authForRegistration), |
| 244 | run: func(compatCache *openAICompatibilityRegistrationCache) { |
| 245 | s.completeModelRegistrationForAuthWithCache(ctx, authForRegistration, compatCache) |
| 246 | }, |
| 247 | }) |
| 248 | } |
| 249 | s.runModelRegistrationTasks(ctx, tasks) |
| 250 | } |
| 251 | |
| 252 | func (s *Service) runModelRegistrationTasks(ctx context.Context, tasks []modelRegistrationTask) { |
| 253 | if len(tasks) == 0 { |
no test coverage detected