From 937978d68afbce63cd8bbaae5f3b265fbe99ddb2 Mon Sep 17 00:00:00 2001 From: YoVinchen Date: Wed, 24 Dec 2025 23:48:41 +0800 Subject: [PATCH] feat(i18n): add proxy takeover translations and update types Add i18n strings for proxy takeover status in zh/en/ja. Update TypeScript types for GlobalProxyConfig and AppProxyConfig. --- src/components/settings/SettingsPage.tsx | 100 ++++++++++++++++------- src/i18n/locales/en.json | 18 +++- src/i18n/locales/ja.json | 18 +++- src/i18n/locales/zh.json | 18 +++- src/types/proxy.ts | 24 ++++++ 5 files changed, 146 insertions(+), 32 deletions(-) diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx index 30481bd3d..44c538af5 100644 --- a/src/components/settings/SettingsPage.tsx +++ b/src/components/settings/SettingsPage.tsx @@ -384,47 +384,89 @@ export function SettingsPage({ )} - {/* 故障转移队列管理 - 每个应用独立 */} -
-
-

- {t("proxy.failoverQueue.title")} -

-

- {t("proxy.failoverQueue.description")} -

-
- - - Claude - Codex - Gemini - - + {/* 故障转移设置 - 按应用分组 */} + + + Claude + Codex + Gemini + + +
+
+

+ {t("proxy.failoverQueue.title")} +

+

+ {t("proxy.failoverQueue.description")} +

+
- - +
+
+ +
+
+ +
+
+

+ {t("proxy.failoverQueue.title")} +

+

+ {t("proxy.failoverQueue.description")} +

+
- - +
+
+ +
+
+ +
+
+

+ {t("proxy.failoverQueue.title")} +

+

+ {t("proxy.failoverQueue.description")} +

+
- - -
- - {/* 熔断器配置 - 全局共享 */} -
- -
+
+
+ +
+ + diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 5bfba75f1..88cf7336b 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1083,7 +1083,7 @@ "failureThresholdHint": "Open circuit breaker after this many consecutive failures (recommended: 3-10)", "timeout": "Recovery Wait Time (seconds)", "timeoutHint": "Wait this long before trying to recover after circuit opens (recommended: 30-120)", - "circuitBreakerSettings": "Circuit Breaker Advanced Settings", + "circuitBreakerSettings": "Circuit Breaker Settings", "successThreshold": "Recovery Success Threshold", "successThresholdHint": "Close circuit breaker after this many successes in half-open state", "errorRate": "Error Rate Threshold (%)", @@ -1112,5 +1112,21 @@ "timeout": "Timeout (seconds)", "maxRetries": "Max Retries", "degradedThreshold": "Degraded Threshold (ms)" + }, + "proxyConfig": { + "proxyEnabled": "Proxy Enabled", + "appTakeover": "Proxy Enabled", + "perAppConfig": "Per-App Config", + "circuitBreaker": "Circuit Breaker", + "circuitBreakerSettings": "Circuit Breaker Settings", + "failureThreshold": "Failure Threshold", + "successThreshold": "Success Threshold", + "recoveryTimeout": "Recovery Timeout", + "errorRateThreshold": "Error Rate Threshold", + "minRequests": "Min Requests", + "timeoutConfig": "Timeout Config", + "streamingFirstByte": "Streaming First Byte Timeout", + "streamingIdle": "Streaming Idle Timeout", + "nonStreaming": "Non-Streaming Timeout" } } diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 6ea1a9065..93567bf0b 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -1083,7 +1083,7 @@ "failureThresholdHint": "この回数連続で失敗するとサーキットブレーカーが開きます(推奨: 3-10)", "timeout": "回復待ち時間(秒)", "timeoutHint": "サーキットが開いた後、回復を試みるまでの待ち時間(推奨: 30-120)", - "circuitBreakerSettings": "サーキットブレーカー詳細設定", + "circuitBreakerSettings": "サーキットブレーカー設定", "successThreshold": "回復成功しきい値", "successThresholdHint": "半開状態でこの回数成功するとサーキットブレーカーが閉じます", "errorRate": "エラー率しきい値 (%)", @@ -1112,5 +1112,21 @@ "timeout": "タイムアウト(秒)", "maxRetries": "最大リトライ回数", "degradedThreshold": "劣化しきい値(ミリ秒)" + }, + "proxyConfig": { + "proxyEnabled": "プロキシ有効", + "appTakeover": "プロキシ有効", + "perAppConfig": "アプリ別設定", + "circuitBreaker": "サーキットブレーカー", + "circuitBreakerSettings": "サーキットブレーカー設定", + "failureThreshold": "失敗閾値", + "successThreshold": "回復閾値", + "recoveryTimeout": "回復待機時間", + "errorRateThreshold": "エラー率閾値", + "minRequests": "最小リクエスト数", + "timeoutConfig": "タイムアウト設定", + "streamingFirstByte": "ストリーミング初回バイトタイムアウト", + "streamingIdle": "ストリーミングアイドルタイムアウト", + "nonStreaming": "非ストリーミングタイムアウト" } } diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 73cfab25c..55aeb99bb 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -1083,7 +1083,7 @@ "failureThresholdHint": "连续失败多少次后打开熔断器(建议: 3-10)", "timeout": "恢复等待时间(秒)", "timeoutHint": "熔断器打开后,等待多久后尝试恢复(建议: 30-120)", - "circuitBreakerSettings": "熔断器高级设置", + "circuitBreakerSettings": "熔断器设置", "successThreshold": "恢复成功阈值", "successThresholdHint": "半开状态下成功多少次后关闭熔断器", "errorRate": "错误率阈值 (%)", @@ -1112,5 +1112,21 @@ "timeout": "超时时间(秒)", "maxRetries": "最大重试次数", "degradedThreshold": "降级阈值(毫秒)" + }, + "proxyConfig": { + "proxyEnabled": "代理总开关", + "appTakeover": "代理启用", + "perAppConfig": "应用配置", + "circuitBreaker": "熔断器配置", + "circuitBreakerSettings": "熔断器设置", + "failureThreshold": "失败阈值", + "successThreshold": "恢复阈值", + "recoveryTimeout": "恢复等待时间", + "errorRateThreshold": "错误率阈值", + "minRequests": "最小请求数", + "timeoutConfig": "超时配置", + "streamingFirstByte": "流式首字节超时", + "streamingIdle": "流式静默超时", + "nonStreaming": "非流式超时" } } diff --git a/src/types/proxy.ts b/src/types/proxy.ts index fac5ecb8e..4d11370ad 100644 --- a/src/types/proxy.ts +++ b/src/types/proxy.ts @@ -109,3 +109,27 @@ export interface FailoverQueueItem { providerName: string; sortIndex?: number; } + +// 全局代理配置(统一字段,三行镜像) +export interface GlobalProxyConfig { + proxyEnabled: boolean; + listenAddress: string; + listenPort: number; + enableLogging: boolean; +} + +// 应用级代理配置(每个 app 独立) +export interface AppProxyConfig { + appType: string; + enabled: boolean; + autoFailoverEnabled: boolean; + maxRetries: number; + streamingFirstByteTimeout: number; + streamingIdleTimeout: number; + nonStreamingTimeout: number; + circuitFailureThreshold: number; + circuitSuccessThreshold: number; + circuitTimeoutSeconds: number; + circuitErrorRateThreshold: number; + circuitMinRequests: number; +}