mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
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)
54 lines
1.2 KiB
Go
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
|
|
}
|
|
}
|