mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-03-30 00:33:35 +00:00
Fix enterprise profile mapping for Claude OAuth account type
This commit is contained in:
@@ -641,7 +641,11 @@ class ClaudeAccountService {
|
||||
if (info.hasClaudePro === true && info.hasClaudeMax !== true) {
|
||||
return false // Claude Pro 不支持 Opus
|
||||
}
|
||||
if (info.accountType === 'claude_pro' || info.accountType === 'claude_free') {
|
||||
if (
|
||||
info.accountType === 'claude_pro' ||
|
||||
info.accountType === 'claude_free' ||
|
||||
info.accountType === 'free'
|
||||
) {
|
||||
return false // 明确标记为 Pro 或 Free 的账号不支持
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -747,7 +751,11 @@ class ClaudeAccountService {
|
||||
if (info.hasClaudePro === true && info.hasClaudeMax !== true) {
|
||||
return false // Claude Pro 不支持 Opus
|
||||
}
|
||||
if (info.accountType === 'claude_pro' || info.accountType === 'claude_free') {
|
||||
if (
|
||||
info.accountType === 'claude_pro' ||
|
||||
info.accountType === 'claude_free' ||
|
||||
info.accountType === 'free'
|
||||
) {
|
||||
return false // 明确标记为 Pro 或 Free 的账号不支持
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -1402,14 +1410,19 @@ class ClaudeAccountService {
|
||||
organizationType: profileData.organization?.organization_type
|
||||
})
|
||||
|
||||
const organizationType = String(profileData.organization?.organization_type || '').toLowerCase()
|
||||
const isEnterpriseOrg = organizationType === 'claude_enterprise'
|
||||
const hasClaudeMax = profileData.account?.has_claude_max === true || isEnterpriseOrg
|
||||
const hasClaudePro = profileData.account?.has_claude_pro === true && !hasClaudeMax
|
||||
|
||||
// 构建订阅信息
|
||||
const subscriptionInfo = {
|
||||
// 账号信息
|
||||
email: profileData.account?.email,
|
||||
fullName: profileData.account?.full_name,
|
||||
displayName: profileData.account?.display_name,
|
||||
hasClaudeMax: profileData.account?.has_claude_max || false,
|
||||
hasClaudePro: profileData.account?.has_claude_pro || false,
|
||||
hasClaudeMax,
|
||||
hasClaudePro,
|
||||
accountUuid: profileData.account?.uuid,
|
||||
|
||||
// 组织信息
|
||||
@@ -1419,13 +1432,8 @@ class ClaudeAccountService {
|
||||
rateLimitTier: profileData.organization?.rate_limit_tier,
|
||||
organizationType: profileData.organization?.organization_type,
|
||||
|
||||
// 账号类型(基于 has_claude_max 和 has_claude_pro 判断)
|
||||
accountType:
|
||||
profileData.account?.has_claude_max === true
|
||||
? 'claude_max'
|
||||
: profileData.account?.has_claude_pro === true
|
||||
? 'claude_pro'
|
||||
: 'free',
|
||||
// 账号类型:Enterprise 组织按 Max 能力处理,确保可调度 Opus
|
||||
accountType: hasClaudeMax ? 'claude_max' : hasClaudePro ? 'claude_pro' : 'free',
|
||||
|
||||
// 更新时间
|
||||
profileFetchedAt: new Date().toISOString()
|
||||
|
||||
@@ -282,7 +282,11 @@ class UnifiedClaudeScheduler {
|
||||
logger.info(`🚫 Claude account ${account.name} (Pro) does not support Opus model`)
|
||||
continue // Claude Pro 不支持 Opus
|
||||
}
|
||||
if (info.accountType === 'claude_pro' || info.accountType === 'claude_free') {
|
||||
if (
|
||||
info.accountType === 'claude_pro' ||
|
||||
info.accountType === 'claude_free' ||
|
||||
info.accountType === 'free'
|
||||
) {
|
||||
logger.info(
|
||||
`🚫 Claude account ${account.name} (${info.accountType}) does not support Opus model`
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user