fix(antigravity): support upstream accounts and custom model_mapping in scheduling
- GetAccessToken: add upstream branch to read api_key from credentials - shouldTriggerAntigravitySmartRetry: relax check from IsOAuth to Platform-based - isModelSupportedByAccount/WithContext: replace IsAntigravityModelSupported whitelist with mapAntigravityModel for unified scheduling/forwarding logic - mapAntigravityModel: fix edge case where wildcard target equals request model - Update tests for new behavior and add custom model_mapping test cases
This commit is contained in:
@@ -343,13 +343,13 @@ func TestHandleSmartRetry_503_ModelCapacityExhausted_ReturnsSwitchError(t *testi
|
||||
require.Equal(t, "gemini-3-pro-high", repo.modelRateLimitCalls[0].modelKey)
|
||||
}
|
||||
|
||||
// TestHandleSmartRetry_NonOAuthAccount_ContinuesDefaultLogic 测试非 OAuth 账号走默认逻辑
|
||||
func TestHandleSmartRetry_NonOAuthAccount_ContinuesDefaultLogic(t *testing.T) {
|
||||
// TestHandleSmartRetry_NonAntigravityAccount_ContinuesDefaultLogic 测试非 Antigravity 平台账号走默认逻辑
|
||||
func TestHandleSmartRetry_NonAntigravityAccount_ContinuesDefaultLogic(t *testing.T) {
|
||||
account := &Account{
|
||||
ID: 4,
|
||||
Name: "acc-4",
|
||||
Type: AccountTypeAPIKey, // 非 OAuth 账号
|
||||
Platform: PlatformAntigravity,
|
||||
Type: AccountTypeAPIKey, // 非 Antigravity 平台账号
|
||||
Platform: PlatformAnthropic,
|
||||
}
|
||||
|
||||
// 即使是模型限流响应,非 OAuth 账号也应该走默认逻辑
|
||||
@@ -385,7 +385,7 @@ func TestHandleSmartRetry_NonOAuthAccount_ContinuesDefaultLogic(t *testing.T) {
|
||||
result := handleSmartRetry(params, resp, respBody, "https://ag-1.test", 0, availableURLs)
|
||||
|
||||
require.NotNil(t, result)
|
||||
require.Equal(t, smartRetryActionContinue, result.action, "non-OAuth account should continue default logic")
|
||||
require.Equal(t, smartRetryActionContinue, result.action, "non-Antigravity platform account should continue default logic")
|
||||
require.Nil(t, result.resp)
|
||||
require.Nil(t, result.err)
|
||||
require.Nil(t, result.switchError)
|
||||
|
||||
Reference in New Issue
Block a user