fix(proxy): preserve URL query/fragment and improve error handling

Extract shared URL utilities to handle query strings and fragments correctly.
Add race condition fix for URL preview, improve proxy toggle error feedback,
and support Codex chat format proxy endpoint.
This commit is contained in:
YoVinchen
2026-02-05 16:48:44 +08:00
parent b12d12790b
commit 75d78da920
12 changed files with 274 additions and 54 deletions
+9 -1
View File
@@ -160,7 +160,11 @@
"openAIChatFormatRequiresProxy": "This provider uses OpenAI Chat format and requires the proxy service for format conversion. Please enable the proxy and takeover the current app first.",
"fullUrlRequiresProxy": "This provider is configured with a full API path. The client may append duplicate paths in direct connection mode. Please enable the proxy and takeover the current app first.",
"urlMismatchRequiresProxy": "This provider's request URL configuration does not match the API format. It cannot work properly in direct connection mode. Please enable the proxy and takeover the current app first.",
"fullUrlWarningOnDisable": "The current provider is configured with a full API path or special format. It may not work properly after disabling the proxy. Consider switching to a base URL configuration or keep the proxy enabled."
"fullUrlWarningOnDisable": "The current provider is configured with a full API path or special format. It may not work properly after disabling the proxy. Consider switching to a base URL configuration or keep the proxy enabled.",
"openAIChatFormatWarningOnDisable": "The current provider uses OpenAI Chat format. It may not work properly after disabling the proxy. Consider keeping the proxy enabled.",
"urlMismatchWarningOnDisable": "The current provider's request URL configuration may rely on the proxy. It may not work properly after disabling the proxy. Consider switching to a base URL configuration or keep the proxy enabled.",
"switchAppliedUnverified": "Switch applied (direct mode not verified)",
"switchAppliedUnverifiedDesc": "Unable to verify whether this endpoint requires the proxy. If it doesn't work after switching, enable the proxy and takeover the current app."
},
"confirm": {
"deleteProvider": "Delete Provider",
@@ -1291,6 +1295,10 @@
}
},
"proxy": {
"takeover": {
"toggleFailed": "Failed to toggle takeover",
"toggleFailedDesc": "Check proxy service status and permissions, then try again."
},
"panel": {
"serviceAddress": "Service Address",
"addressCopied": "Address copied",
+9 -1
View File
@@ -160,7 +160,11 @@
"openAIChatFormatRequiresProxy": "このプロバイダーは OpenAI Chat フォーマットを使用しており、フォーマット変換のためにプロキシサービスが必要です。先にプロキシを有効にして、現在のアプリをテイクオーバーしてください。",
"fullUrlRequiresProxy": "このプロバイダーは完全な API パスで構成されています。直接接続モードではクライアントがパスを重複追加する可能性があります。先にプロキシを有効にして、現在のアプリをテイクオーバーしてください。",
"urlMismatchRequiresProxy": "このプロバイダーのリクエスト URL 設定が API フォーマットと一致しません。直接接続モードでは正常に動作しません。先にプロキシを有効にして、現在のアプリをテイクオーバーしてください。",
"fullUrlWarningOnDisable": "現在のプロバイダーは完全な API パスまたは特殊なフォーマットで構成されています。プロキシを無効にすると正常に動作しない可能性があります。ベース URL 設定に変更するか、プロキシを有効のままにすることをお勧めします。"
"fullUrlWarningOnDisable": "現在のプロバイダーは完全な API パスまたは特殊なフォーマットで構成されています。プロキシを無効にすると正常に動作しない可能性があります。ベース URL 設定に変更するか、プロキシを有効のままにすることをお勧めします。",
"openAIChatFormatWarningOnDisable": "現在のプロバイダーは OpenAI Chat フォーマットを使用しています。プロキシを無効にすると正常に動作しない可能性があります。プロキシを有効のままにすることをお勧めします。",
"urlMismatchWarningOnDisable": "現在のプロバイダーのリクエスト URL 設定はプロキシに依存している可能性があります。プロキシを無効にすると正常に動作しない可能性があります。ベース URL 設定に変更するか、プロキシを有効のままにすることをお勧めします。",
"switchAppliedUnverified": "切り替えを適用しました(直接接続は未検証)",
"switchAppliedUnverifiedDesc": "このエンドポイントがプロキシを必要とするか検証できませんでした。切り替え後に動作しない場合は、プロキシを有効にして現在のアプリをテイクオーバーしてください。"
},
"confirm": {
"deleteProvider": "プロバイダーを削除",
@@ -1282,6 +1286,10 @@
}
},
"proxy": {
"takeover": {
"toggleFailed": "テイクオーバーの切り替えに失敗しました",
"toggleFailedDesc": "プロキシサービスの状態と権限を確認して、もう一度お試しください。"
},
"panel": {
"serviceAddress": "サービスアドレス",
"addressCopied": "アドレスをコピーしました",
+9 -1
View File
@@ -160,7 +160,11 @@
"openAIChatFormatRequiresProxy": "此供应商使用 OpenAI Chat 格式,需要开启代理服务进行格式转换才能正常使用。请先开启代理并接管当前应用。",
"fullUrlRequiresProxy": "此供应商配置了完整 API 路径,直连模式下客户端可能会重复追加路径。请先开启代理并接管当前应用。",
"urlMismatchRequiresProxy": "此供应商的请求地址配置与 API 格式不匹配,直连模式下无法正常工作。请先开启代理并接管当前应用。",
"fullUrlWarningOnDisable": "当前供应商配置了完整 API 路径或特殊格式,关闭代理后可能无法正常工作。建议更换为基础地址配置或保持代理开启。"
"fullUrlWarningOnDisable": "当前供应商配置了完整 API 路径或特殊格式,关闭代理后可能无法正常工作。建议更换为基础地址配置或保持代理开启。",
"openAIChatFormatWarningOnDisable": "当前供应商使用 OpenAI Chat 格式,关闭代理后可能无法正常工作。建议保持代理开启。",
"urlMismatchWarningOnDisable": "当前供应商的请求地址配置可能依赖代理模式,关闭代理后可能无法正常工作。建议更换为基础地址配置或保持代理开启。",
"switchAppliedUnverified": "切换已应用(未验证直连兼容性)",
"switchAppliedUnverifiedDesc": "未能验证该端点是否需要代理。如果切换后无法正常使用,请开启代理并接管当前应用。"
},
"confirm": {
"deleteProvider": "删除供应商",
@@ -1291,6 +1295,10 @@
}
},
"proxy": {
"takeover": {
"toggleFailed": "切换接管状态失败",
"toggleFailedDesc": "请检查代理服务状态与权限,然后重试。"
},
"panel": {
"serviceAddress": "服务地址",
"addressCopied": "地址已复制",