Unified · Split
| @@ -97,7 +97,7 @@ func (e *GeminiCLIExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth · 96 unmodified lines | ||
| 97 | 97 | var lastStatus int |
| 98 | 98 | var lastBody []byte |
| 99 | 99 | |
| 100 | − for _, attemptModel := range models { | |
| 100 | + for idx, attemptModel := range models { | |
| 101 | 101 | payload := append([]byte(nil), basePayload...) |
| 102 | 102 | if action == "countTokens" { |
| 103 | 103 | payload = deleteJSONField(payload, "project") |
| @@ -170,7 +170,11 @@ func (e *GeminiCLIExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth · 66 unmodified lines | ||
| 170 | 170 | lastBody = append([]byte(nil), data...) |
| 171 | 171 | log.Debugf("request error, error status: %d, error body: %s", httpResp.StatusCode, string(data)) |
| 172 | 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 | 178 | continue |
| 175 | 179 | } |
| 176 | 180 | |
| @@ -228,7 +232,7 @@ func (e *GeminiCLIExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut · 51 unmodified lines | ||
| 228 | 232 | var lastStatus int |
| 229 | 233 | var lastBody []byte |
| 230 | 234 | |
| 231 | − for _, attemptModel := range models { | |
| 235 | + for idx, attemptModel := range models { | |
| 232 | 236 | payload := append([]byte(nil), basePayload...) |
| 233 | 237 | payload = setJSONField(payload, "project", projectID) |
| 234 | 238 | payload = setJSONField(payload, "model", attemptModel) |
| @@ -290,7 +294,11 @@ func (e *GeminiCLIExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut · 55 unmodified lines | ||
| 290 | 294 | lastBody = append([]byte(nil), data...) |
| 291 | 295 | log.Debugf("request error, error status: %d, error body: %s", httpResp.StatusCode, string(data)) |
| 292 | 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 | 302 | continue |
| 295 | 303 | } |
| 296 | 304 | err = statusErr{code: httpResp.StatusCode, msg: string(data)} |