mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 18:37:46 +08:00
fix(providers): retry initial empty quota before showing feedback
This commit is contained in:
@@ -980,6 +980,7 @@ import ProviderQuotaProgressRow from '@/features/providers/components/ProviderQu
|
||||
import ProviderQuotaSectionHeader from '@/features/providers/components/ProviderQuotaSectionHeader.vue'
|
||||
import { useProxyNodesStore } from '@/stores/proxy-nodes'
|
||||
import { resolveAntigravityQuotaGroupLabel } from '@/features/providers/utils/antigravityQuota'
|
||||
import { refreshQuotaInBackground } from '@/features/providers/utils/refreshQuotaInBackground'
|
||||
import {
|
||||
deleteEndpointKey,
|
||||
recoverKeyHealth,
|
||||
@@ -2862,15 +2863,21 @@ async function autoRefreshQuotaInBackground(): Promise<boolean> {
|
||||
}
|
||||
|
||||
refreshingQuota.value = true
|
||||
const isCurrent = () => props.open && props.providerId === providerId
|
||||
try {
|
||||
const result = await refreshProviderQuota(providerId)
|
||||
const result = await refreshQuotaInBackground({
|
||||
refresh: () => refreshProviderQuota(providerId),
|
||||
isCurrent,
|
||||
retryInitialEmptyQuota: providerType === 'antigravity' && !hadCachedQuota,
|
||||
})
|
||||
if (!result) return false
|
||||
const applied = applyQuotaResults(result.results)
|
||||
if (result.success <= 0 && applied === 0 && !hadCachedQuota && providerType === 'antigravity') {
|
||||
showError(legacyT('没有获取到配额信息(请检查账号是否已授权、project_id 是否存在)'), legacyT('提示'))
|
||||
showWarning(legacyT('配额暂未就绪,请稍后刷新'), legacyT('提示'))
|
||||
}
|
||||
return applied > 0
|
||||
} catch (err: unknown) {
|
||||
if (!hadCachedQuota && providerType === 'antigravity') {
|
||||
if (isCurrent() && !hadCachedQuota && providerType === 'antigravity') {
|
||||
showError(localizedApiError(err, '后台刷新配额失败'), legacyT('错误'))
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user