From 8c8b265ebf591da1203f021c1f951dcecae4a79b Mon Sep 17 00:00:00 2001 From: YoVinchen Date: Thu, 19 Mar 2026 22:50:01 +0800 Subject: [PATCH] refactor(ui): refine full URL endpoint hint --- .../providers/forms/shared/EndpointField.tsx | 79 +++++++++++-------- src/i18n/locales/en.json | 3 +- src/i18n/locales/ja.json | 3 +- src/i18n/locales/zh.json | 3 +- 4 files changed, 50 insertions(+), 38 deletions(-) diff --git a/src/components/providers/forms/shared/EndpointField.tsx b/src/components/providers/forms/shared/EndpointField.tsx index ead98889..bf33afc9 100644 --- a/src/components/providers/forms/shared/EndpointField.tsx +++ b/src/components/providers/forms/shared/EndpointField.tsx @@ -1,6 +1,7 @@ import { useTranslation } from "react-i18next"; import { FormLabel } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; +import { Switch } from "@/components/ui/switch"; import { Link2, Zap } from "lucide-react"; interface EndpointFieldProps { @@ -37,12 +38,47 @@ export function EndpointField({ const defaultManageLabel = t("providerForm.manageAndTest", { defaultValue: "管理和测速", }); + const effectiveHint = + showFullUrlToggle && isFullUrl + ? t("providerForm.fullUrlHint", { + defaultValue: + "💡 请填写完整请求 URL,并且必须开启代理后使用;代理将直接使用此 URL,不拼接路径", + }) + : hint; return (
-
- {label} - {showManageButton && onManageClick && ( +
+
+ {label} + {showFullUrlToggle && onFullUrlChange ? ( +
+ + + {t("providerForm.fullUrlLabel", { + defaultValue: "完整 URL", + })} + + +
+ ) : null} +
+ {showManageButton && onManageClick ? ( - )} + ) : null}
- {showFullUrlToggle && onFullUrlChange ? ( -
- - {isFullUrl ? ( - - {t("providerForm.fullUrlHint", { - defaultValue: "代理将直接使用此 URL,不拼接路径", - })} - - ) : null} -
- ) : null} - {hint ? ( + {effectiveHint ? (
-

{hint}

+

+ {effectiveHint} +

) : null}
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index e76ec37c..cce07e2a 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -743,9 +743,10 @@ "anthropicReasoningModel": "Reasoning Model (Thinking)", "apiFormat": "API Format", "apiFormatHint": "Select the input format for the provider's API", + "fullUrlLabel": "Full URL", "fullUrlEnabled": "Full URL Mode", "fullUrlDisabled": "Mark as Full URL", - "fullUrlHint": "Proxy will use this URL as-is", + "fullUrlHint": "💡 Enter the full request URL. This mode requires the proxy to be enabled, and the proxy will use the URL as-is without appending a path", "apiFormatAnthropic": "Anthropic Messages (Native)", "apiFormatOpenAIChat": "OpenAI Chat Completions (Requires proxy)", "apiFormatOpenAIResponses": "OpenAI Responses API (Requires proxy)", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 5844299d..dadbcef4 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -743,9 +743,10 @@ "anthropicReasoningModel": "推論モデル(Thinking)", "apiFormat": "API フォーマット", "apiFormatHint": "プロバイダー API の入力フォーマットを選択", + "fullUrlLabel": "フル URL", "fullUrlEnabled": "フル URL モード", "fullUrlDisabled": "フル URL として設定", - "fullUrlHint": "プロキシはこの URL をそのまま使用", + "fullUrlHint": "💡 完全なリクエスト URL を入力してください。このモードはプロキシを有効にして使用する必要があり、プロキシはこの URL をそのまま使用し、パスを追加しません", "apiFormatAnthropic": "Anthropic Messages(ネイティブ)", "apiFormatOpenAIChat": "OpenAI Chat Completions(プロキシが必要)", "apiFormatOpenAIResponses": "OpenAI Responses API(プロキシが必要)", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index ff265be7..46443326 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -743,9 +743,10 @@ "anthropicReasoningModel": "推理模型 (Thinking)", "apiFormat": "API 格式", "apiFormatHint": "选择供应商 API 的输入格式", + "fullUrlLabel": "完整 URL", "fullUrlEnabled": "完整 URL 模式", "fullUrlDisabled": "标记为完整 URL", - "fullUrlHint": "代理将直接使用此 URL,不拼接路径", + "fullUrlHint": "💡 请填写完整请求 URL,并且必须开启代理后使用;代理将直接使用此 URL,不拼接路径", "apiFormatAnthropic": "Anthropic Messages (原生)", "apiFormatOpenAIChat": "OpenAI Chat Completions (需开启代理)", "apiFormatOpenAIResponses": "OpenAI Responses API (需开启代理)",