From a0115955816f01a31ea0a1a756d46de69e157d21 Mon Sep 17 00:00:00 2001 From: Jackwwg83 Date: Fri, 13 Feb 2026 10:05:53 +0800 Subject: [PATCH 1/2] Fix enterprise profile mapping for Claude OAuth account type --- src/services/claudeAccountService.js | 30 ++++++++++++++++---------- src/services/unifiedClaudeScheduler.js | 6 +++++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/services/claudeAccountService.js b/src/services/claudeAccountService.js index 6577535d..06c6456b 100644 --- a/src/services/claudeAccountService.js +++ b/src/services/claudeAccountService.js @@ -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() diff --git a/src/services/unifiedClaudeScheduler.js b/src/services/unifiedClaudeScheduler.js index 287bb465..bbae7c2c 100644 --- a/src/services/unifiedClaudeScheduler.js +++ b/src/services/unifiedClaudeScheduler.js @@ -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` ) From a8afb1523b2c978b48571b84d800e4dacd7f1d7d Mon Sep 17 00:00:00 2001 From: Jackwwg83 Date: Sat, 14 Feb 2026 10:22:03 +0800 Subject: [PATCH 2/2] style: format enterprise profile mapping line for prettier --- src/services/account/claudeAccountService.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/account/claudeAccountService.js b/src/services/account/claudeAccountService.js index 7d2bca99..8e876990 100644 --- a/src/services/account/claudeAccountService.js +++ b/src/services/account/claudeAccountService.js @@ -2119,7 +2119,9 @@ class ClaudeAccountService { organizationType: profileData.organization?.organization_type }) - const organizationType = String(profileData.organization?.organization_type || '').toLowerCase() + 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