Unified · Split
| @@ -97,7 +97,7 @@ func (e *GeminiCLIExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth · 96 unmodified lines | |||
| 97 | var lastStatus int | 97 | var lastStatus int |
| 98 | var lastBody []byte | 98 | var lastBody []byte |
| 99 | 99 | ||
| 100 | for _, attemptModel := range models { | 100 | for idx, attemptModel := range models { |
| 101 | payload := append([]byte(nil), basePayload...) | 101 | payload := append([]byte(nil), basePayload...) |
| 102 | if action == "countTokens" { | 102 | if action == "countTokens" { |
| 103 | payload = deleteJSONField(payload, "project") | 103 | payload = deleteJSONField(payload, "project") |
| @@ -170,7 +170,11 @@ func (e *GeminiCLIExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth · 66 unmodified lines | |||
| 170 | lastBody = append([]byte(nil), data...) | 170 | lastBody = append([]byte(nil), data...) |
| 171 | log.Debugf("request error, error status: %d, error body: %s", httpResp.StatusCode, string(data)) | 171 | log.Debugf("request error, error status: %d, error body: %s", httpResp.StatusCode, string(data)) |
| 172 | if httpResp.StatusCode == 429 { | 172 | if httpResp.StatusCode == 429 { |
| 173 | log.Debugf("gemini cli executor: rate limited, retrying with next model") | 173 | if idx+1 < len(models) { |
| 174 | log.Debugf("gemini cli executor: rate limited, retrying with next model: %s", models[idx+1]) | ||
| 175 | } else { | ||
| 176 | log.Debug("gemini cli executor: rate limited, no additional fallback model") | ||
| 177 | } | ||
| 174 | continue | 178 | continue |
| 175 | } | 179 | } |
| 176 | 180 | ||
| @@ -228,7 +232,7 @@ func (e *GeminiCLIExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut · 51 unmodified lines | |||
| 228 | var lastStatus int | 232 | var lastStatus int |
| 229 | var lastBody []byte | 233 | var lastBody []byte |
| 230 | 234 | ||
| 231 | for _, attemptModel := range models { | 235 | for idx, attemptModel := range models { |
| 232 | payload := append([]byte(nil), basePayload...) | 236 | payload := append([]byte(nil), basePayload...) |
| 233 | payload = setJSONField(payload, "project", projectID) | 237 | payload = setJSONField(payload, "project", projectID) |
| 234 | payload = setJSONField(payload, "model", attemptModel) | 238 | payload = setJSONField(payload, "model", attemptModel) |
| @@ -290,7 +294,11 @@ func (e *GeminiCLIExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut · 55 unmodified lines | |||
| 290 | lastBody = append([]byte(nil), data...) | 294 | lastBody = append([]byte(nil), data...) |
| 291 | log.Debugf("request error, error status: %d, error body: %s", httpResp.StatusCode, string(data)) | 295 | log.Debugf("request error, error status: %d, error body: %s", httpResp.StatusCode, string(data)) |
| 292 | if httpResp.StatusCode == 429 { | 296 | if httpResp.StatusCode == 429 { |
| 293 | log.Debugf("gemini cli executor: rate limited, retrying with next model") | 297 | if idx+1 < len(models) { |
| 298 | log.Debugf("gemini cli executor: rate limited, retrying with next model: %s", models[idx+1]) | ||
| 299 | } else { | ||
| 300 | log.Debug("gemini cli executor: rate limited, no additional fallback model") | ||
| 301 | } | ||
| 294 | continue | 302 | continue |
| 295 | } | 303 | } |
| 296 | err = statusErr{code: httpResp.StatusCode, msg: string(data)} | 304 | err = statusErr{code: httpResp.StatusCode, msg: string(data)} |