Unify quota snapshots and oauth refresh handling

This commit is contained in:
fawney19
2026-04-17 18:22:41 +08:00
parent b8702ae124
commit 7eae1f90f6
38 changed files with 3435 additions and 458 deletions

View File

@@ -148,7 +148,7 @@
</div>
<div class="flex items-center gap-1.5 mt-0.5 text-[11px] text-muted-foreground flex-wrap">
<span :class="key.is_active ? '' : 'text-destructive'">{{ key.is_active ? '启用' : '禁用' }}</span>
<span v-if="key.account_quota">{{ shortenQuota(key.account_quota) }}</span>
<span v-if="getQuotaText(key)">{{ shortenQuota(getQuotaText(key) || '') }}</span>
<span v-if="key.proxy?.node_id">独立代理</span>
<span
v-if="key.last_used_at"
@@ -300,6 +300,7 @@ import {
getOAuthStatusDisplay,
getOAuthStatusTitle,
} from '@/utils/providerKeyStatus'
import { getQuotaDisplayText } from '@/utils/providerKeyQuota'
type QuickSelectorValue =
| 'banned'
@@ -488,6 +489,10 @@ function formatRelativeTime(value: string): string {
return `${Math.floor(diff / 86_400_000)}天前`
}
function getQuotaText(key: PoolKeyDetail): string | null {
return getQuotaDisplayText(key, props.providerType)
}
function shortenQuota(raw: string): string {
return raw.split('|').map((segment) => {
let value = segment.trim()