From 5cf47e588035010fed5a7076aa7a02debec47cb4 Mon Sep 17 00:00:00 2001 From: HybridTalentComputing <1316645276@qq.com> Date: Tue, 23 Dec 2025 23:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90provider=E7=9A=84=E6=B1=89?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/common/ApiKeyField.tsx | 27 +++---- .../settings/common/BaseUrlField.tsx | 12 ++-- .../settings/providers/AnthropicProvider.tsx | 5 +- .../settings/providers/AskSageProvider.tsx | 10 +-- .../settings/providers/BedrockProvider.tsx | 65 +++++++++-------- .../settings/providers/DifyProvider.tsx | 23 ++---- .../settings/providers/FireworksProvider.tsx | 38 +++++----- .../settings/providers/GeminiProvider.tsx | 11 +-- .../settings/providers/HicapProvider.tsx | 6 +- .../providers/HuggingFaceProvider.tsx | 25 ++++--- .../settings/providers/LMStudioProvider.tsx | 38 ++++++---- .../settings/providers/MiniMaxProvider.tsx | 9 +-- .../settings/providers/MoonshotProvider.tsx | 8 ++- .../settings/providers/NebiusProvider.tsx | 6 +- .../settings/providers/OllamaProvider.tsx | 50 +++++++------ .../settings/providers/OpenAICompatible.tsx | 20 +++--- .../settings/providers/OpenRouterProvider.tsx | 16 ++--- .../settings/providers/RequestyProvider.tsx | 8 ++- .../settings/providers/TogetherProvider.tsx | 12 ++-- .../providers/VercelAIGatewayProvider.tsx | 32 +++++---- webview-ui/src/locales/en/common.json | 72 +++++++++++++++++++ webview-ui/src/locales/zh-CN/common.json | 72 +++++++++++++++++++ 22 files changed, 372 insertions(+), 193 deletions(-) diff --git a/webview-ui/src/components/settings/common/ApiKeyField.tsx b/webview-ui/src/components/settings/common/ApiKeyField.tsx index d968ddf8..39abf2f1 100644 --- a/webview-ui/src/components/settings/common/ApiKeyField.tsx +++ b/webview-ui/src/components/settings/common/ApiKeyField.tsx @@ -1,4 +1,5 @@ import { VSCodeLink, VSCodeTextField } from "@vscode/webview-ui-toolkit/react" +import { useTranslation } from "react-i18next" import { useDebouncedInput } from "../utils/useDebouncedInput" /** @@ -16,26 +17,27 @@ interface ApiKeyFieldProps { /** * A reusable component for API key input fields with standard styling and help text for signing up for key */ -export const ApiKeyField = ({ - initialValue, - onChange, - providerName, - signupUrl, - placeholder = "Enter API Key...", - helpText, -}: ApiKeyFieldProps) => { +export const ApiKeyField = ({ initialValue, onChange, providerName, signupUrl, placeholder, helpText }: ApiKeyFieldProps) => { + const { t } = useTranslation() const [localValue, setLocalValue] = useDebouncedInput(initialValue, onChange) + const defaultPlaceholder = placeholder || t("settings.apiConfig.apiKeyPlaceholder") + const defaultHelpText = helpText || t("settings.apiConfig.apiKeyStoredLocally") + const getApiKeyText = /^[aeiou]/i.test(providerName) + ? t("settings.apiConfig.getApiKeyAn", { providerName }) + : t("settings.apiConfig.getApiKey", { providerName }) return (
- {helpText || "This key is stored locally and only used to make API requests from this extension."}
+ {defaultHelpText}
{!localValue && signupUrl && (
{apiConfiguration?.awsUseProfile - ? "Using AWS Profile credentials from ~/.aws/credentials. Leave profile name empty to use the default profile. These credentials are only used locally to make API requests from this extension." - : "Authenticate by either providing the keys above or use the default AWS credential providers, i.e. ~/.aws/credentials or environment variables. These credentials are only used locally to make API requests from this extension."} + ? t("settings.apiConfig.awsProfileDescription") + : t("settings.apiConfig.awsCredentialsDescription")}
{showModelOptions && ( <>- Select "Custom" when using the Application Inference Profile in Bedrock. Enter the Application - Inference Profile ARN in the Model ID field. -
+{t("settings.apiConfig.customModelDescription")}
- Dify is a platform that provides access to various AI models through a unified API. Configure your Dify - instance URL and API key to get started. -
+{t("settings.apiConfig.difyDescription")}
- Note: The model selection is handled within your Dify application configuration. + {t("settings.apiConfig.note")} {t("settings.apiConfig.difyNote")}
- This key is stored locally and only used to make API requests from this extension. We don’t show pricing here
- because it depends on your Hugging Face provider settings and isn’t consistently available via their API{" "}
-
- Get your API key here
-
+
lms server start to use it with this extension.{" "}
+ api.minimaxi.com for China, or{" "}
- api.minimax.io for all other locations.
+ {t("settings.apiConfig.minimaxEndpointDescription")}
- Unable to fetch models from Ollama server. Please ensure Ollama is running and accessible, or enter the model - ID manually above. -
+{t("settings.apiConfig.unableToFetchModels")}
)}- Maximum time in milliseconds to wait for API responses before timing out. -
+{t("settings.apiConfig.requestTimeoutDescription")}
> )} @@ -133,15 +131,21 @@ export const OllamaProvider = ({ showModelOptions, isPopup, currentMode }: Ollam marginTop: "5px", color: "var(--vscode-descriptionForeground)", }}> - Ollama allows you to run models locally on your computer. For instructions on how to get started, see their{" "} -- This key is stored locally and only used to make API requests from this extension. + {t("settings.apiConfig.apiKeyStoredLocally")}
- (Note: Cline uses complex prompts and works best with Claude models. - Less capable models may not work as expected.) + ({t("settings.apiConfig.note")}{" "} + {t("settings.apiConfig.clineBestWithClaude")})
- This key is stored locally and only used to make API requests from this extension.
+ {t("settings.apiConfig.apiKeyStoredLocally")}
{!apiConfiguration?.vercelAiGatewayApiKey && (
<>
{" "}
- You can get a Vercel AI Gateway API key by{" "}
-