mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 19:09:15 +00:00
Merge pull request #287 from sczheng189/fix-schedulable-check
fix: 修复重置账号状态后仍被认为不可用的bug
This commit is contained in:
@@ -630,7 +630,10 @@ class ClaudeAccountService {
|
|||||||
const accounts = await redis.getAllClaudeAccounts()
|
const accounts = await redis.getAllClaudeAccounts()
|
||||||
|
|
||||||
let activeAccounts = accounts.filter(
|
let activeAccounts = accounts.filter(
|
||||||
(account) => account.isActive === 'true' && account.status !== 'error'
|
(account) =>
|
||||||
|
account.isActive === 'true' &&
|
||||||
|
account.status !== 'error' &&
|
||||||
|
account.schedulable !== 'false'
|
||||||
)
|
)
|
||||||
|
|
||||||
// 如果请求的是 Opus 模型,过滤掉 Pro 和 Free 账号
|
// 如果请求的是 Opus 模型,过滤掉 Pro 和 Free 账号
|
||||||
@@ -717,7 +720,12 @@ class ClaudeAccountService {
|
|||||||
// 如果API Key绑定了专属账户,优先使用
|
// 如果API Key绑定了专属账户,优先使用
|
||||||
if (apiKeyData.claudeAccountId) {
|
if (apiKeyData.claudeAccountId) {
|
||||||
const boundAccount = await redis.getClaudeAccount(apiKeyData.claudeAccountId)
|
const boundAccount = await redis.getClaudeAccount(apiKeyData.claudeAccountId)
|
||||||
if (boundAccount && boundAccount.isActive === 'true' && boundAccount.status !== 'error') {
|
if (
|
||||||
|
boundAccount &&
|
||||||
|
boundAccount.isActive === 'true' &&
|
||||||
|
boundAccount.status !== 'error' &&
|
||||||
|
boundAccount.schedulable !== 'false'
|
||||||
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`🎯 Using bound dedicated account: ${boundAccount.name} (${apiKeyData.claudeAccountId}) for API key ${apiKeyData.name}`
|
`🎯 Using bound dedicated account: ${boundAccount.name} (${apiKeyData.claudeAccountId}) for API key ${apiKeyData.name}`
|
||||||
)
|
)
|
||||||
@@ -736,6 +744,7 @@ class ClaudeAccountService {
|
|||||||
(account) =>
|
(account) =>
|
||||||
account.isActive === 'true' &&
|
account.isActive === 'true' &&
|
||||||
account.status !== 'error' &&
|
account.status !== 'error' &&
|
||||||
|
account.schedulable !== 'false' &&
|
||||||
(account.accountType === 'shared' || !account.accountType) // 兼容旧数据
|
(account.accountType === 'shared' || !account.accountType) // 兼容旧数据
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user