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

Function collectAvailableByPriority

sdk/cliproxy/auth/selector.go:199–217  ·  view source on GitHub ↗
(auths []*Auth, model string, now time.Time)

Source from the content-addressed store, hash-verified

197}
198
199func collectAvailableByPriority(auths []*Auth, model string, now time.Time) (available map[int][]*Auth, cooldownCount int, earliest time.Time) {
200 available = make(map[int][]*Auth)
201 for i := 0; i < len(auths); i++ {
202 candidate := auths[i]
203 blocked, reason, next := isAuthBlockedForModel(candidate, model, now)
204 if !blocked {
205 priority := authPriority(candidate)
206 available[priority] = append(available[priority], candidate)
207 continue
208 }
209 if reason == blockReasonCooldown {
210 cooldownCount++
211 if !next.IsZero() && (earliest.IsZero() || next.Before(earliest)) {
212 earliest = next
213 }
214 }
215 }
216 return available, cooldownCount, earliest
217}
218
219func getAvailableAuths(auths []*Auth, provider, model string, now time.Time) ([]*Auth, error) {
220 if len(auths) == 0 {

Callers 1

getAvailableAuthsFunction · 0.85

Calls 2

isAuthBlockedForModelFunction · 0.85
authPriorityFunction · 0.85

Tested by

no test coverage detected