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

Function preferCodexWebsocketAuths

sdk/cliproxy/auth/selector.go:175–197  ·  view source on GitHub ↗
(ctx context.Context, provider string, available []*Auth)

Source from the content-addressed store, hash-verified

173}
174
175func preferCodexWebsocketAuths(ctx context.Context, provider string, available []*Auth) []*Auth {
176 if len(available) == 0 {
177 return available
178 }
179 if !cliproxyexecutor.DownstreamWebsocket(ctx) {
180 return available
181 }
182 if !strings.EqualFold(strings.TrimSpace(provider), "codex") {
183 return available
184 }
185
186 wsEnabled := make([]*Auth, 0, len(available))
187 for i := 0; i < len(available); i++ {
188 candidate := available[i]
189 if authWebsocketsEnabled(candidate) {
190 wsEnabled = append(wsEnabled, candidate)
191 }
192 }
193 if len(wsEnabled) > 0 {
194 return wsEnabled
195 }
196 return available
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)

Callers 2

PickMethod · 0.85
PickMethod · 0.85

Calls 1

authWebsocketsEnabledFunction · 0.85

Tested by

no test coverage detected