fix(antigravity): fetch default mapping from API and sync Redis on rate limit
1. Frontend: replace hardcoded antigravityDefaultMappings with async fetch from GET /admin/accounts/antigravity/default-model-mapping, eliminating the duplicate data source that caused frontend/backend mapping inconsistency. 2. Backend: convert handleSmartRetry and antigravityRetryLoop from standalone functions to AntigravityGatewayService methods, enabling Redis cache sync (updateAccountModelRateLimitInCache) after both rate-limit write paths — long-delay branch and retry-exhausted branch.
This commit is contained in:
@@ -1980,7 +1980,7 @@ import {
|
||||
getModelsByPlatform,
|
||||
commonErrorCodes,
|
||||
buildModelMappingObject,
|
||||
antigravityDefaultMappings,
|
||||
fetchAntigravityDefaultMappings,
|
||||
isValidWildcardPattern
|
||||
} from '@/composables/useModelWhitelist'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
@@ -2270,7 +2270,9 @@ watch(
|
||||
// Antigravity: 默认使用映射模式并填充默认映射
|
||||
if (form.platform === 'antigravity') {
|
||||
antigravityModelRestrictionMode.value = 'mapping'
|
||||
antigravityModelMappings.value = [...antigravityDefaultMappings]
|
||||
fetchAntigravityDefaultMappings().then(mappings => {
|
||||
antigravityModelMappings.value = [...mappings]
|
||||
})
|
||||
antigravityWhitelistModels.value = []
|
||||
} else {
|
||||
antigravityWhitelistModels.value = []
|
||||
@@ -2318,7 +2320,9 @@ watch(
|
||||
// Antigravity: 默认使用映射模式并填充默认映射
|
||||
if (newPlatform === 'antigravity') {
|
||||
antigravityModelRestrictionMode.value = 'mapping'
|
||||
antigravityModelMappings.value = [...antigravityDefaultMappings]
|
||||
fetchAntigravityDefaultMappings().then(mappings => {
|
||||
antigravityModelMappings.value = [...mappings]
|
||||
})
|
||||
antigravityWhitelistModels.value = []
|
||||
accountCategory.value = 'oauth-based'
|
||||
antigravityAccountType.value = 'oauth'
|
||||
@@ -2576,7 +2580,9 @@ const resetForm = () => {
|
||||
|
||||
antigravityModelRestrictionMode.value = 'mapping'
|
||||
antigravityWhitelistModels.value = []
|
||||
antigravityModelMappings.value = [...antigravityDefaultMappings]
|
||||
fetchAntigravityDefaultMappings().then(mappings => {
|
||||
antigravityModelMappings.value = [...mappings]
|
||||
})
|
||||
customErrorCodesEnabled.value = false
|
||||
selectedErrorCodes.value = []
|
||||
customErrorCodeInput.value = null
|
||||
|
||||
Reference in New Issue
Block a user