mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
fix: 优化codex 429限流显示为恩替
This commit is contained in:
@@ -1181,25 +1181,6 @@ class ClaudeAccountService {
|
||||
`✅ 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 }
|
||||
} catch (error) {
|
||||
logger.error(`❌ Failed to remove rate limit for account: ${accountId}`, error)
|
||||
|
||||
@@ -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) {
|
||||
return account.stoppedReason
|
||||
|
||||
Reference in New Issue
Block a user