fix: 修复droid类型账号类型显示

This commit is contained in:
shaw
2025-10-11 11:48:20 +08:00
parent 6f2307721b
commit a6f5876eca

View File

@@ -546,7 +546,9 @@
>Droid</span
>
<span class="mx-1 h-4 w-px bg-cyan-300 dark:bg-cyan-600" />
<span class="text-xs font-medium text-cyan-700 dark:text-cyan-300">OAuth</span>
<span class="text-xs font-medium text-cyan-700 dark:text-cyan-300">
{{ getDroidAuthType(account) }}
</span>
</div>
<div
v-else
@@ -2972,6 +2974,52 @@ const getOpenAIAuthType = () => {
return 'OAuth'
}
// 获取 Droid 账号的认证方式
const getDroidAuthType = (account) => {
if (!account || typeof account !== 'object') {
return 'OAuth'
}
const apiKeyModeFlag =
account.isApiKeyMode ?? account.is_api_key_mode ?? account.apiKeyMode ?? account.api_key_mode
if (
apiKeyModeFlag === true ||
apiKeyModeFlag === 'true' ||
apiKeyModeFlag === 1 ||
apiKeyModeFlag === '1'
) {
return 'API Key'
}
const methodCandidate =
account.authenticationMethod ||
account.authMethod ||
account.authentication_mode ||
account.authenticationMode ||
account.authentication_method ||
account.auth_type ||
account.authType ||
account.authentication_type ||
account.authenticationType ||
account.droidAuthType ||
account.droidAuthenticationMethod ||
account.method ||
account.auth ||
''
if (typeof methodCandidate === 'string') {
const normalized = methodCandidate.trim().toLowerCase()
const compacted = normalized.replace(/[\s_-]/g, '')
if (compacted === 'apikey') {
return 'API Key'
}
}
return 'OAuth'
}
// 获取 Claude 账号类型显示
const getClaudeAccountType = (account) => {
// 如果有订阅信息