MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / registerModelsForAuthBatch

Method registerModelsForAuthBatch

sdk/cliproxy/service.go:231–250  ·  view source on GitHub ↗
(ctx context.Context, auths []*coreauth.Auth)

Source from the content-addressed store, hash-verified

229}
230
231func (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
252func (s *Service) runModelRegistrationTasks(ctx context.Context, tasks []modelRegistrationTask) {
253 if len(tasks) == 0 {

Callers 1

Calls 5

modelRegistrationPhaseFunction · 0.85
CloneMethod · 0.45

Tested by

no test coverage detected