mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-25 23:25:42 +00:00
fix: optimize Claude Console quota exceeded status display
- Keep account status as 'active' when quota exceeded (not 'quota_exceeded') - Keep isActive as true, only use quotaStoppedAt to mark quota exceeded - Show green status in UI for quota exceeded accounts (normal state) - Show '余额不足' as unschedulable reason instead of '已暂停' - Simplify resetDailyUsage() to only check quotaStoppedAt field Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2
web/admin-spa/package-lock.json
generated
2
web/admin-spa/package-lock.json
generated
@@ -3789,7 +3789,7 @@
|
||||
},
|
||||
"node_modules/prettier-plugin-tailwindcss": {
|
||||
"version": "0.6.14",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.14.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.14.tgz",
|
||||
"integrity": "sha512-pi2e/+ZygeIqntN+vC573BcW5Cve8zUB0SSAGxqpB4f96boZF4M3phPVoOFCeypwkpRYdi7+jQ5YJJUwrkGUAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
|
||||
@@ -4125,6 +4125,14 @@ const getSchedulableReason = (account) => {
|
||||
if (account.rateLimitStatus === 'limited') {
|
||||
return '触发限流(429错误)'
|
||||
}
|
||||
// 检查配额超限状态(quotaAutoStopped 或 quotaStoppedAt 任一存在即表示配额超限)
|
||||
if (
|
||||
account.quotaAutoStopped === 'true' ||
|
||||
account.quotaAutoStopped === true ||
|
||||
account.quotaStoppedAt
|
||||
) {
|
||||
return '余额不足'
|
||||
}
|
||||
if (account.status === 'blocked' && account.errorMessage) {
|
||||
return account.errorMessage
|
||||
}
|
||||
@@ -4203,6 +4211,15 @@ const getSchedulableReason = (account) => {
|
||||
return '手动停止调度'
|
||||
}
|
||||
|
||||
// 检查是否是配额超限状态(用于状态显示判断)
|
||||
const isQuotaExceeded = (account) => {
|
||||
return (
|
||||
account.quotaAutoStopped === 'true' ||
|
||||
account.quotaAutoStopped === true ||
|
||||
!!account.quotaStoppedAt
|
||||
)
|
||||
}
|
||||
|
||||
// 获取账户状态文本
|
||||
const getAccountStatusText = (account) => {
|
||||
// 检查是否被封锁
|
||||
@@ -4221,9 +4238,9 @@ const getAccountStatusText = (account) => {
|
||||
if (account.status === 'temp_error') return '临时异常'
|
||||
// 检查是否错误
|
||||
if (account.status === 'error' || !account.isActive) return '错误'
|
||||
// 检查是否可调度
|
||||
if (account.schedulable === false) return '已暂停'
|
||||
// 否则正常
|
||||
// 配额超限时显示"正常"(不显示"已暂停")
|
||||
if (account.schedulable === false && !isQuotaExceeded(account)) return '已暂停'
|
||||
// 否则正常(包括配额超限状态)
|
||||
return '正常'
|
||||
}
|
||||
|
||||
@@ -4249,7 +4266,8 @@ const getAccountStatusClass = (account) => {
|
||||
if (account.status === 'error' || !account.isActive) {
|
||||
return 'bg-red-100 text-red-800'
|
||||
}
|
||||
if (account.schedulable === false) {
|
||||
// 配额超限时显示绿色(正常)
|
||||
if (account.schedulable === false && !isQuotaExceeded(account)) {
|
||||
return 'bg-gray-100 text-gray-800'
|
||||
}
|
||||
return 'bg-green-100 text-green-800'
|
||||
@@ -4277,7 +4295,8 @@ const getAccountStatusDotClass = (account) => {
|
||||
if (account.status === 'error' || !account.isActive) {
|
||||
return 'bg-red-500'
|
||||
}
|
||||
if (account.schedulable === false) {
|
||||
// 配额超限时显示绿色(正常)
|
||||
if (account.schedulable === false && !isQuotaExceeded(account)) {
|
||||
return 'bg-gray-500'
|
||||
}
|
||||
return 'bg-green-500'
|
||||
|
||||
Reference in New Issue
Block a user