Files
ProxyPilot/internal/runtime/executor/quota_fallback.go
RCD 0af0ad14e5 Merge upstream CLIProxyAPI v6.8.28–v6.8.32
Upstream changes:
- Codex responses compaction payload compatibility
- Codex usage_limit_reached retry-after, deterministic parsing
- Codex refresh_token_reused non-retryable fix
- Qwen rate limiting and quota error handling
- Context management compatibility simplification
- Antigravity tool_result image fix, model list backfill, deep copy cache
- Auth auto-refresh interval/concurrency limiting
- Auth hook OnResult refactor (replaces MarkResult)
- Gemini-3.1-flash-image support
- Registry cleanup of outdated model definitions

Fork resolution:
- Accept upstream's consolidated conductor.go (auto-refresh, round-tripper)
- Delete stale conductor_oauth.go, conductor_token.go (upstream reversed split)
- Delete stale provider_rotation_test.go (references removed method)
2026-02-27 20:58:16 +07:00

54 lines
1.2 KiB
Go

package executor
import (
"strings"
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
)
func parseProjectIDCandidates(raw string) []string {
raw = strings.TrimSpace(raw)
if raw == "" {
return nil
}
parts := strings.Split(raw, ",")
out := make([]string, 0, len(parts))
seen := make(map[string]struct{}, len(parts))
for _, part := range parts {
part = strings.TrimSpace(part)
if part == "" {
continue
}
key := strings.ToLower(part)
if _, ok := seen[key]; ok {
continue
}
seen[key] = struct{}{}
out = append(out, part)
}
return out
}
func projectIDCandidatesFromAuth(auth *cliproxyauth.Auth) []string {
if auth == nil || auth.Metadata == nil {
return nil
}
if raw, ok := auth.Metadata["project_id"].(string); ok {
return parseProjectIDCandidates(raw)
}
return nil
}
func quotaPreviewFallbackOrder(model string) []string {
model = strings.TrimSpace(model)
switch model {
// Gemini 3: fallback to pro preview (observed highest availability).
case "gemini-3-flash", "gemini-3-flash-high", "gemini-3-flash-preview":
return []string{"gemini-3-pro-preview"}
case "gemini-3-pro", "gemini-3-pro-high":
return []string{"gemini-3-pro-preview"}
default:
return nil
}
}