mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
fix(frontend): 优化 OAuth 身份徽章优先级并避免 Kiro 订阅标签重复
- getOAuthOrgBadge 优先展示 organization id, 其次回落到 account_id 或 account_user_id, 不再使用 account_name 作为徽章文案 - Kiro provider 的订阅标签仅在与 OAuth plan 标签不一致时显示, 避免重复徽章 - 补充 getOAuthOrgBadge 的单元测试覆盖组织优先与回落场景
This commit is contained in:
@@ -315,12 +315,12 @@
|
||||
</Badge>
|
||||
<!-- Kiro 订阅类型标签 -->
|
||||
<Badge
|
||||
v-if="provider.provider_type === 'kiro' && getKiroSubscriptionTitle(key)"
|
||||
v-if="shouldShowKiroSubscriptionBadge(key)"
|
||||
variant="outline"
|
||||
class="text-[10px] px-1.5 py-0 shrink-0"
|
||||
:class="getOAuthPlanTypeClass(formatKiroSubscription(getKiroSubscriptionTitle(key)))"
|
||||
:class="getOAuthPlanTypeClass(getKiroSubscriptionBadgeLabel(key))"
|
||||
>
|
||||
{{ formatKiroSubscription(getKiroSubscriptionTitle(key)) }}
|
||||
{{ getKiroSubscriptionBadgeLabel(key) }}
|
||||
</Badge>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
@@ -2074,6 +2074,22 @@ function getKiroSubscriptionTitle(key: EndpointAPIKey): string | undefined {
|
||||
return getKiroQuotaDisplay(key)?.subscription_title
|
||||
}
|
||||
|
||||
function getKiroSubscriptionBadgeLabel(key: EndpointAPIKey): string {
|
||||
return formatKiroSubscription(getKiroSubscriptionTitle(key))
|
||||
}
|
||||
|
||||
function shouldShowKiroSubscriptionBadge(key: EndpointAPIKey): boolean {
|
||||
if (provider.value?.provider_type !== 'kiro') return false
|
||||
|
||||
const kiroLabel = getKiroSubscriptionBadgeLabel(key)
|
||||
if (!kiroLabel) return false
|
||||
|
||||
const oauthPlanLabel = formatOAuthPlanType(key.oauth_plan_type)
|
||||
if (!oauthPlanLabel) return true
|
||||
|
||||
return oauthPlanLabel.trim().toLowerCase() !== kiroLabel.trim().toLowerCase()
|
||||
}
|
||||
|
||||
function shouldAutoRefreshCodexQuota(): boolean {
|
||||
if (provider.value?.provider_type !== 'codex') return false
|
||||
const now = Math.floor(Date.now() / 1000)
|
||||
|
||||
Reference in New Issue
Block a user