mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-26 06:24:32 +08:00
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.
This commit is contained in:
@@ -384,47 +384,89 @@ export function SettingsPage({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 故障转移队列管理 - 每个应用独立 */}
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold">
|
||||
{t("proxy.failoverQueue.title")}
|
||||
</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("proxy.failoverQueue.description")}
|
||||
</p>
|
||||
</div>
|
||||
<Tabs defaultValue="claude" className="w-full">
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
<TabsTrigger value="claude">Claude</TabsTrigger>
|
||||
<TabsTrigger value="codex">Codex</TabsTrigger>
|
||||
<TabsTrigger value="gemini">Gemini</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="claude" className="mt-4">
|
||||
{/* 故障转移设置 - 按应用分组 */}
|
||||
<Tabs defaultValue="claude" className="w-full">
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
<TabsTrigger value="claude">Claude</TabsTrigger>
|
||||
<TabsTrigger value="codex">Codex</TabsTrigger>
|
||||
<TabsTrigger value="gemini">Gemini</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent
|
||||
value="claude"
|
||||
className="mt-4 space-y-6"
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold">
|
||||
{t("proxy.failoverQueue.title")}
|
||||
</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("proxy.failoverQueue.description")}
|
||||
</p>
|
||||
</div>
|
||||
<FailoverQueueManager
|
||||
appType="claude"
|
||||
disabled={!isRunning}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="codex" className="mt-4">
|
||||
</div>
|
||||
<div className="border-t border-border/50 pt-6">
|
||||
<AutoFailoverConfigPanel
|
||||
appType="claude"
|
||||
disabled={!isRunning}
|
||||
/>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent
|
||||
value="codex"
|
||||
className="mt-4 space-y-6"
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold">
|
||||
{t("proxy.failoverQueue.title")}
|
||||
</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("proxy.failoverQueue.description")}
|
||||
</p>
|
||||
</div>
|
||||
<FailoverQueueManager
|
||||
appType="codex"
|
||||
disabled={!isRunning}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="gemini" className="mt-4">
|
||||
</div>
|
||||
<div className="border-t border-border/50 pt-6">
|
||||
<AutoFailoverConfigPanel
|
||||
appType="codex"
|
||||
disabled={!isRunning}
|
||||
/>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent
|
||||
value="gemini"
|
||||
className="mt-4 space-y-6"
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold">
|
||||
{t("proxy.failoverQueue.title")}
|
||||
</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("proxy.failoverQueue.description")}
|
||||
</p>
|
||||
</div>
|
||||
<FailoverQueueManager
|
||||
appType="gemini"
|
||||
disabled={!isRunning}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
{/* 熔断器配置 - 全局共享 */}
|
||||
<div className="border-t border-border/50 pt-6">
|
||||
<AutoFailoverConfigPanel />
|
||||
</div>
|
||||
</div>
|
||||
<div className="border-t border-border/50 pt-6">
|
||||
<AutoFailoverConfigPanel
|
||||
appType="gemini"
|
||||
disabled={!isRunning}
|
||||
/>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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": "非ストリーミングタイムアウト"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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": "非流式超时"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user