From 953c5036bfcb40922c9769d3c776f3e2d33b0e46 Mon Sep 17 00:00:00 2001 From: QTom Date: Sat, 28 Feb 2026 01:29:45 +0800 Subject: [PATCH] feat: add RPM types and i18n translations --- frontend/src/i18n/locales/en.ts | 18 +++++++++++++++++- frontend/src/i18n/locales/zh.ts | 18 +++++++++++++++++- frontend/src/types/index.ts | 6 ++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index a4087237..f730a04f 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -1613,7 +1613,12 @@ export default { sessions: { full: 'Active sessions full, new sessions must wait (idle timeout: {idle} min)', normal: 'Active sessions normal (idle timeout: {idle} min)' - } + }, + rpm: { + full: 'RPM limit reached', + warning: 'RPM approaching limit', + normal: 'RPM normal', + }, }, tempUnschedulable: { title: 'Temp Unschedulable', @@ -1828,6 +1833,17 @@ export default { idleTimeoutPlaceholder: '5', idleTimeoutHint: 'Sessions will be released after idle timeout' }, + rpmLimit: { + label: 'RPM Limit', + hint: 'Limit requests per minute to protect upstream accounts', + baseRpm: 'Base RPM', + baseRpmPlaceholder: '15', + baseRpmHint: 'Max requests per minute, 0 or empty means no limit', + strategy: 'RPM Strategy', + strategyTiered: 'Tiered Model', + strategyStickyExempt: 'Sticky Exempt', + strategyHint: 'Tiered: gradually restrict when exceeded; Sticky Exempt: existing sessions unrestricted', + }, tlsFingerprint: { label: 'TLS Fingerprint Simulation', hint: 'Simulate Node.js/Claude Code client TLS fingerprint' diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index e338457d..b2e72fd8 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -1664,7 +1664,12 @@ export default { sessions: { full: '活跃会话已满,新会话需等待(空闲超时:{idle}分钟)', normal: '活跃会话正常(空闲超时:{idle}分钟)' - } + }, + rpm: { + full: '已达 RPM 上限', + warning: 'RPM 接近上限', + normal: 'RPM 正常', + }, }, clearRateLimit: '清除速率限制', testConnection: '测试连接', @@ -1971,6 +1976,17 @@ export default { idleTimeoutPlaceholder: '5', idleTimeoutHint: '会话空闲超时后自动释放' }, + rpmLimit: { + label: 'RPM 限制', + hint: '限制每分钟请求数量,保护上游账号', + baseRpm: '基础 RPM', + baseRpmPlaceholder: '15', + baseRpmHint: '每分钟最大请求数,0 或留空表示不限制', + strategy: 'RPM 策略', + strategyTiered: '三区模型', + strategyStickyExempt: '粘性豁免', + strategyHint: '三区模型: 超限后逐步限制; 粘性豁免: 已有会话不受限', + }, tlsFingerprint: { label: 'TLS 指纹模拟', hint: '模拟 Node.js/Claude Code 客户端的 TLS 指纹' diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index a8497985..1db50165 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -661,6 +661,11 @@ export interface Account { max_sessions?: number | null session_idle_timeout_minutes?: number | null + // RPM 限制(仅 Anthropic OAuth/SetupToken 账号有效) + base_rpm?: number | null + rpm_strategy?: string | null + rpm_sticky_buffer?: number | null + // TLS指纹伪装(仅 Anthropic OAuth/SetupToken 账号有效) enable_tls_fingerprint?: boolean | null @@ -675,6 +680,7 @@ export interface Account { // 运行时状态(仅当启用对应限制时返回) current_window_cost?: number | null // 当前窗口费用 active_sessions?: number | null // 当前活跃会话数 + current_rpm?: number | null // 当前分钟 RPM 计数 } // Account Usage types