mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-04 19:45:34 +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>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 故障转移队列管理 - 每个应用独立 */}
|
{/* 故障转移设置 - 按应用分组 */}
|
||||||
<div className="space-y-4">
|
<Tabs defaultValue="claude" className="w-full">
|
||||||
<div>
|
<TabsList className="grid w-full grid-cols-3">
|
||||||
<h4 className="text-sm font-semibold">
|
<TabsTrigger value="claude">Claude</TabsTrigger>
|
||||||
{t("proxy.failoverQueue.title")}
|
<TabsTrigger value="codex">Codex</TabsTrigger>
|
||||||
</h4>
|
<TabsTrigger value="gemini">Gemini</TabsTrigger>
|
||||||
<p className="text-xs text-muted-foreground">
|
</TabsList>
|
||||||
{t("proxy.failoverQueue.description")}
|
<TabsContent
|
||||||
</p>
|
value="claude"
|
||||||
</div>
|
className="mt-4 space-y-6"
|
||||||
<Tabs defaultValue="claude" className="w-full">
|
>
|
||||||
<TabsList className="grid w-full grid-cols-3">
|
<div className="space-y-4">
|
||||||
<TabsTrigger value="claude">Claude</TabsTrigger>
|
<div>
|
||||||
<TabsTrigger value="codex">Codex</TabsTrigger>
|
<h4 className="text-sm font-semibold">
|
||||||
<TabsTrigger value="gemini">Gemini</TabsTrigger>
|
{t("proxy.failoverQueue.title")}
|
||||||
</TabsList>
|
</h4>
|
||||||
<TabsContent value="claude" className="mt-4">
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{t("proxy.failoverQueue.description")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<FailoverQueueManager
|
<FailoverQueueManager
|
||||||
appType="claude"
|
appType="claude"
|
||||||
disabled={!isRunning}
|
disabled={!isRunning}
|
||||||
/>
|
/>
|
||||||
</TabsContent>
|
</div>
|
||||||
<TabsContent value="codex" className="mt-4">
|
<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
|
<FailoverQueueManager
|
||||||
appType="codex"
|
appType="codex"
|
||||||
disabled={!isRunning}
|
disabled={!isRunning}
|
||||||
/>
|
/>
|
||||||
</TabsContent>
|
</div>
|
||||||
<TabsContent value="gemini" className="mt-4">
|
<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
|
<FailoverQueueManager
|
||||||
appType="gemini"
|
appType="gemini"
|
||||||
disabled={!isRunning}
|
disabled={!isRunning}
|
||||||
/>
|
/>
|
||||||
</TabsContent>
|
</div>
|
||||||
</Tabs>
|
<div className="border-t border-border/50 pt-6">
|
||||||
</div>
|
<AutoFailoverConfigPanel
|
||||||
|
appType="gemini"
|
||||||
{/* 熔断器配置 - 全局共享 */}
|
disabled={!isRunning}
|
||||||
<div className="border-t border-border/50 pt-6">
|
/>
|
||||||
<AutoFailoverConfigPanel />
|
</div>
|
||||||
</div>
|
</TabsContent>
|
||||||
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
|
|||||||
@@ -1083,7 +1083,7 @@
|
|||||||
"failureThresholdHint": "Open circuit breaker after this many consecutive failures (recommended: 3-10)",
|
"failureThresholdHint": "Open circuit breaker after this many consecutive failures (recommended: 3-10)",
|
||||||
"timeout": "Recovery Wait Time (seconds)",
|
"timeout": "Recovery Wait Time (seconds)",
|
||||||
"timeoutHint": "Wait this long before trying to recover after circuit opens (recommended: 30-120)",
|
"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",
|
"successThreshold": "Recovery Success Threshold",
|
||||||
"successThresholdHint": "Close circuit breaker after this many successes in half-open state",
|
"successThresholdHint": "Close circuit breaker after this many successes in half-open state",
|
||||||
"errorRate": "Error Rate Threshold (%)",
|
"errorRate": "Error Rate Threshold (%)",
|
||||||
@@ -1112,5 +1112,21 @@
|
|||||||
"timeout": "Timeout (seconds)",
|
"timeout": "Timeout (seconds)",
|
||||||
"maxRetries": "Max Retries",
|
"maxRetries": "Max Retries",
|
||||||
"degradedThreshold": "Degraded Threshold (ms)"
|
"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)",
|
"failureThresholdHint": "この回数連続で失敗するとサーキットブレーカーが開きます(推奨: 3-10)",
|
||||||
"timeout": "回復待ち時間(秒)",
|
"timeout": "回復待ち時間(秒)",
|
||||||
"timeoutHint": "サーキットが開いた後、回復を試みるまでの待ち時間(推奨: 30-120)",
|
"timeoutHint": "サーキットが開いた後、回復を試みるまでの待ち時間(推奨: 30-120)",
|
||||||
"circuitBreakerSettings": "サーキットブレーカー詳細設定",
|
"circuitBreakerSettings": "サーキットブレーカー設定",
|
||||||
"successThreshold": "回復成功しきい値",
|
"successThreshold": "回復成功しきい値",
|
||||||
"successThresholdHint": "半開状態でこの回数成功するとサーキットブレーカーが閉じます",
|
"successThresholdHint": "半開状態でこの回数成功するとサーキットブレーカーが閉じます",
|
||||||
"errorRate": "エラー率しきい値 (%)",
|
"errorRate": "エラー率しきい値 (%)",
|
||||||
@@ -1112,5 +1112,21 @@
|
|||||||
"timeout": "タイムアウト(秒)",
|
"timeout": "タイムアウト(秒)",
|
||||||
"maxRetries": "最大リトライ回数",
|
"maxRetries": "最大リトライ回数",
|
||||||
"degradedThreshold": "劣化しきい値(ミリ秒)"
|
"degradedThreshold": "劣化しきい値(ミリ秒)"
|
||||||
|
},
|
||||||
|
"proxyConfig": {
|
||||||
|
"proxyEnabled": "プロキシ有効",
|
||||||
|
"appTakeover": "プロキシ有効",
|
||||||
|
"perAppConfig": "アプリ別設定",
|
||||||
|
"circuitBreaker": "サーキットブレーカー",
|
||||||
|
"circuitBreakerSettings": "サーキットブレーカー設定",
|
||||||
|
"failureThreshold": "失敗閾値",
|
||||||
|
"successThreshold": "回復閾値",
|
||||||
|
"recoveryTimeout": "回復待機時間",
|
||||||
|
"errorRateThreshold": "エラー率閾値",
|
||||||
|
"minRequests": "最小リクエスト数",
|
||||||
|
"timeoutConfig": "タイムアウト設定",
|
||||||
|
"streamingFirstByte": "ストリーミング初回バイトタイムアウト",
|
||||||
|
"streamingIdle": "ストリーミングアイドルタイムアウト",
|
||||||
|
"nonStreaming": "非ストリーミングタイムアウト"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1083,7 +1083,7 @@
|
|||||||
"failureThresholdHint": "连续失败多少次后打开熔断器(建议: 3-10)",
|
"failureThresholdHint": "连续失败多少次后打开熔断器(建议: 3-10)",
|
||||||
"timeout": "恢复等待时间(秒)",
|
"timeout": "恢复等待时间(秒)",
|
||||||
"timeoutHint": "熔断器打开后,等待多久后尝试恢复(建议: 30-120)",
|
"timeoutHint": "熔断器打开后,等待多久后尝试恢复(建议: 30-120)",
|
||||||
"circuitBreakerSettings": "熔断器高级设置",
|
"circuitBreakerSettings": "熔断器设置",
|
||||||
"successThreshold": "恢复成功阈值",
|
"successThreshold": "恢复成功阈值",
|
||||||
"successThresholdHint": "半开状态下成功多少次后关闭熔断器",
|
"successThresholdHint": "半开状态下成功多少次后关闭熔断器",
|
||||||
"errorRate": "错误率阈值 (%)",
|
"errorRate": "错误率阈值 (%)",
|
||||||
@@ -1112,5 +1112,21 @@
|
|||||||
"timeout": "超时时间(秒)",
|
"timeout": "超时时间(秒)",
|
||||||
"maxRetries": "最大重试次数",
|
"maxRetries": "最大重试次数",
|
||||||
"degradedThreshold": "降级阈值(毫秒)"
|
"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;
|
providerName: string;
|
||||||
sortIndex?: number;
|
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