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{" "}
-