diff --git a/src/components/providers/forms/ProviderForm.tsx b/src/components/providers/forms/ProviderForm.tsx index ed6ad6d..aff1fd6 100644 --- a/src/components/providers/forms/ProviderForm.tsx +++ b/src/components/providers/forms/ProviderForm.tsx @@ -456,6 +456,7 @@ export function ProviderForm({ categoryKeys={categoryKeys} presetCategoryLabels={presetCategoryLabels} onPresetChange={handlePresetChange} + category={category} /> )} diff --git a/src/components/providers/forms/ProviderPresetSelector.tsx b/src/components/providers/forms/ProviderPresetSelector.tsx index 4f0ca65..bcba24f 100644 --- a/src/components/providers/forms/ProviderPresetSelector.tsx +++ b/src/components/providers/forms/ProviderPresetSelector.tsx @@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next"; import { FormLabel } from "@/components/ui/form"; import type { ProviderPreset } from "@/config/providerPresets"; import type { CodexProviderPreset } from "@/config/codexProviderPresets"; +import type { ProviderCategory } from "@/types"; type PresetEntry = { id: string; @@ -14,6 +15,7 @@ interface ProviderPresetSelectorProps { categoryKeys: string[]; presetCategoryLabels: Record; onPresetChange: (value: string) => void; + category?: ProviderCategory; // 新增:当前选中的分类 } export function ProviderPresetSelector({ @@ -22,9 +24,40 @@ export function ProviderPresetSelector({ categoryKeys, presetCategoryLabels, onPresetChange, + category, }: ProviderPresetSelectorProps) { const { t } = useTranslation(); + // 根据分类获取提示文字 + const getCategoryHint = () => { + switch (category) { + case "official": + return t("providerForm.officialHint", { + defaultValue: "💡 官方供应商使用浏览器登录,无需配置 API Key", + }); + case "cn_official": + return t("providerForm.cnOfficialApiKeyHint", { + defaultValue: "💡 国产官方供应商只需填写 API Key,请求地址已预设", + }); + case "aggregator": + return t("providerForm.aggregatorApiKeyHint", { + defaultValue: "💡 聚合服务供应商只需填写 API Key 即可使用", + }); + case "third_party": + return t("providerForm.thirdPartyApiKeyHint", { + defaultValue: "💡 第三方供应商需要填写 API Key 和请求地址", + }); + case "custom": + return t("providerForm.customApiKeyHint", { + defaultValue: "💡 自定义配置需手动填写所有必要字段", + }); + default: + return t("providerPreset.hint", { + defaultValue: "选择预设后可继续调整下方字段。", + }); + } + }; + return (
@@ -71,9 +104,7 @@ export function ProviderPresetSelector({ })}

- {t("providerPreset.helper", { - defaultValue: "选择预设后可继续调整下方字段。", - })} + {getCategoryHint()}

); diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index f5a7d69..152feed 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -211,6 +211,11 @@ "codexApiKeyAutoFill": "Just fill in here, auth.json below will be auto-filled", "kimiApiKeyHint": "Fill in to get model list", "apiKeyAutoFill": "Just fill in here, config below will be auto-filled", + "cnOfficialApiKeyHint": "💡 Opensource official providers only need API Key, endpoint is preset", + "aggregatorApiKeyHint": "💡 Aggregator providers only need API Key to use", + "thirdPartyApiKeyHint": "💡 Third-party providers require both API Key and endpoint", + "customApiKeyHint": "💡 Custom configuration requires manually filling all necessary fields", + "officialHint": "💡 Official provider uses browser login, no API Key needed", "getApiKey": "Get API Key", "parameterConfig": "Parameter Config - {{name}} *", "mainModel": "Main Model (optional)", @@ -236,7 +241,7 @@ "smallModelPlaceholder": "claude-3-5-haiku-20241022", "modelHelper": "Optional: Specify default Claude model to use, leave blank to use system default.", "categoryOfficial": "Official", - "categoryCnOfficial": "China Official", + "categoryCnOfficial": "Opensource Official", "categoryAggregation": "Aggregation", "categoryThirdParty": "Third Party" }, diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 5857112..80d18d2 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -211,6 +211,11 @@ "codexApiKeyAutoFill": "只需要填这里,下方 auth.json 会自动填充", "kimiApiKeyHint": "填写后可获取模型列表", "apiKeyAutoFill": "只需要填这里,下方配置会自动填充", + "cnOfficialApiKeyHint": "💡 开源官方供应商只需填写 API Key,请求地址已预设", + "aggregatorApiKeyHint": "💡 聚合服务供应商只需填写 API Key 即可使用", + "thirdPartyApiKeyHint": "💡 第三方供应商需要填写 API Key 和请求地址", + "customApiKeyHint": "💡 自定义配置需手动填写所有必要字段", + "officialHint": "💡 官方供应商使用浏览器登录,无需配置 API Key", "getApiKey": "获取 API Key", "parameterConfig": "参数配置 - {{name}} *", "mainModel": "主模型 (可选)", @@ -236,7 +241,7 @@ "smallModelPlaceholder": "claude-3-5-haiku-20241022", "modelHelper": "可选:指定默认使用的 Claude 模型,留空则使用系统默认。", "categoryOfficial": "官方", - "categoryCnOfficial": "国内官方", + "categoryCnOfficial": "开源官方", "categoryAggregation": "聚合服务", "categoryThirdParty": "第三方" }, diff --git a/src/types.ts b/src/types.ts index 6a55e11..990b609 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,6 @@ export type ProviderCategory = | "official" // 官方 - | "cn_official" // 国产官方 + | "cn_official" // 开源官方(原"国产官方") | "aggregator" // 聚合网站 | "third_party" // 第三方供应商 | "custom"; // 自定义