fix: 优化codex 429限流显示为恩替

This commit is contained in:
shaw
2025-09-08 16:13:24 +08:00
parent d77605a8ad
commit 399e6b9d8c
2 changed files with 17 additions and 19 deletions

View File

@@ -1181,25 +1181,6 @@ class ClaudeAccountService {
`✅ Rate limit removed for account: ${accountData.name} (${accountId}), schedulable restored` `✅ Rate limit removed for account: ${accountData.name} (${accountId}), schedulable restored`
) )
// 发送 Webhook 通知限流已解除
try {
const webhookNotifier = require('../utils/webhookNotifier')
await webhookNotifier.sendAccountAnomalyNotification({
accountId,
accountName: accountData.name || 'Claude Account',
platform: 'claude-oauth',
status: 'recovered',
errorCode: 'CLAUDE_OAUTH_RATE_LIMIT_CLEARED',
reason: 'Rate limit has been cleared and account is now schedulable',
timestamp: getISOStringWithTimezone(new Date())
})
logger.info(
`📢 Webhook notification sent for Claude account ${accountData.name} rate limit cleared`
)
} catch (webhookError) {
logger.error('Failed to send rate limit cleared webhook notification:', webhookError)
}
return { success: true } return { success: true }
} catch (error) { } catch (error) {
logger.error(`❌ Failed to remove rate limit for account: ${accountId}`, error) logger.error(`❌ Failed to remove rate limit for account: ${accountId}`, error)

View File

@@ -1735,6 +1735,23 @@ const getSchedulableReason = (account) => {
} }
} }
// OpenAI 账户的错误状态
if (account.platform === 'openai') {
if (account.status === 'unauthorized') {
return '认证失败401错误'
}
// 检查限流状态 - 兼容嵌套的 rateLimitStatus 对象
if (
(account.rateLimitStatus && account.rateLimitStatus.isRateLimited) ||
account.isRateLimited
) {
return '触发限流429错误'
}
if (account.status === 'error' && account.errorMessage) {
return account.errorMessage
}
}
// 通用原因 // 通用原因
if (account.stoppedReason) { if (account.stoppedReason) {
return account.stoppedReason return account.stoppedReason