(ctx context.Context, provider string, available []*Auth)
| 173 | } |
| 174 | |
| 175 | func 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 | |
| 199 | func collectAvailableByPriority(auths []*Auth, model string, now time.Time) (available map[int][]*Auth, cooldownCount int, earliest time.Time) { |
| 200 | available = make(map[int][]*Auth) |
no test coverage detected