diff --git a/src/services/claudeAccountService.js b/src/services/claudeAccountService.js index ec9e5b11..f931345e 100644 --- a/src/services/claudeAccountService.js +++ b/src/services/claudeAccountService.js @@ -528,7 +528,10 @@ class ClaudeAccountService { useUnifiedClientId: account.useUnifiedClientId === 'true', // 默认为false unifiedClientId: account.unifiedClientId || '', // 统一的客户端标识 // 添加停止原因 - stoppedReason: account.stoppedReason || null + stoppedReason: account.stoppedReason || null, + // 添加 Opus 限流信息 + opusRateLimitedAt: account.opusRateLimitedAt || null, + opusRateLimitEndAt: account.opusRateLimitEndAt || null } }) ) diff --git a/web/admin-spa/src/views/AccountsView.vue b/web/admin-spa/src/views/AccountsView.vue index f804f639..1a9469ee 100644 --- a/web/admin-spa/src/views/AccountsView.vue +++ b/web/admin-spa/src/views/AccountsView.vue @@ -606,9 +606,19 @@ >({{ formatRateLimitTime(account.rateLimitStatus.minutesRemaining) }}) + + + Opus限流 + + ({{ formatOpusLimitEndTime(account.opusRateLimitEndAt) }}) + + 不可调度 @@ -2491,6 +2501,54 @@ const formatRateLimitTime = (minutes) => { } } +// 检查账户是否处于 Opus 限流状态 +const isOpusRateLimited = (account) => { + if (!account.opusRateLimitEndAt) { + return false + } + const endTime = new Date(account.opusRateLimitEndAt) + const now = new Date() + return endTime > now +} + +// 格式化 Opus 限流结束时间 +const formatOpusLimitEndTime = (endTimeStr) => { + if (!endTimeStr) return '' + + const endTime = new Date(endTimeStr) + const now = new Date() + + // 如果已经过期,返回"已解除" + if (endTime <= now) { + return '已解除' + } + + // 计算剩余时间(毫秒) + const remainingMs = endTime - now + const remainingMinutes = Math.floor(remainingMs / (1000 * 60)) + + // 计算天数、小时和分钟 + const days = Math.floor(remainingMinutes / 1440) + const remainingAfterDays = remainingMinutes % 1440 + const hours = Math.floor(remainingAfterDays / 60) + const mins = remainingAfterDays % 60 + + // 格式化显示 + const parts = [] + if (days > 0) { + parts.push(`${days}天`) + } + if (hours > 0) { + parts.push(`${hours}小时`) + } + if (mins > 0 && days === 0) { + // 只有在天数为0时才显示分钟 + parts.push(`${mins}分钟`) + } + + return parts.join('') +} + // 打开创建账户模态框 const openCreateAccountModal = () => { newAccountPlatform.value = null // 重置选择的平台