feat(Antigravity): 为不合格账户显示警告图标

This commit is contained in:
song
2025-12-31 00:34:24 +08:00
parent f284ea72fc
commit 4a0008df47
3 changed files with 40 additions and 2 deletions

View File

@@ -96,7 +96,7 @@
<!-- Antigravity OAuth accounts: show quota from extra field -->
<template v-else-if="account.platform === 'antigravity' && account.type === 'oauth'">
<!-- 账户类型徽章 -->
<div v-if="antigravityTierLabel" class="mb-1">
<div v-if="antigravityTierLabel" class="mb-1 flex items-center gap-1">
<span
:class="[
'inline-block rounded px-1.5 py-0.5 text-[10px] font-medium',
@@ -105,6 +105,28 @@
>
{{ antigravityTierLabel }}
</span>
<!-- 不合格账户警告图标 -->
<span
v-if="hasIneligibleTiers"
class="group relative cursor-help"
>
<svg
class="h-3.5 w-3.5 text-red-500"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
fill-rule="evenodd"
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z"
clip-rule="evenodd"
/>
</svg>
<span
class="pointer-events-none absolute left-0 top-full z-50 mt-1 w-80 whitespace-normal break-words rounded bg-gray-900 px-3 py-2 text-xs leading-relaxed text-white opacity-0 shadow-lg transition-opacity group-hover:opacity-100 dark:bg-gray-700"
>
{{ t('admin.accounts.ineligibleWarning') }}
</span>
</span>
</div>
<div v-if="hasAntigravityQuota" class="space-y-1">
@@ -453,6 +475,18 @@ const antigravityTierClass = computed(() => {
}
})
// 检测账户是否有不合格状态ineligibleTiers
const hasIneligibleTiers = computed(() => {
const extra = props.account.extra as Record<string, unknown> | undefined
if (!extra) return false
const loadCodeAssist = extra.load_code_assist as Record<string, unknown> | undefined
if (!loadCodeAssist) return false
const ineligibleTiers = loadCodeAssist.ineligibleTiers as unknown[] | undefined
return Array.isArray(ineligibleTiers) && ineligibleTiers.length > 0
})
const loadUsage = async () => {
// Fetch usage for Anthropic OAuth and Setup Token accounts
// OpenAI usage comes from account.extra field (updated during forwarding)

View File

@@ -1194,7 +1194,9 @@ export default {
free: 'Free',
pro: 'Pro',
ultra: 'Ultra'
}
},
ineligibleWarning:
'This account is not eligible for Antigravity, but API forwarding still works. Use at your own risk.'
},
// Proxies

View File

@@ -994,6 +994,8 @@ export default {
pro: 'Pro',
ultra: 'Ultra'
},
ineligibleWarning:
'该账号无 Antigravity 使用权限,但仍能进行 API 转发。继续使用请自行承担风险。',
form: {
nameLabel: '账号名称',
namePlaceholder: '请输入账号名称',