完成provider的汉化
This commit is contained in:
1 parent
3f9c18c5d0
commit
5cf47e5880
22 files changed
+372
-193
No files matched your search
@@ -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 (
|
||||
<div>
|
||||
<VSCodeTextField
|
||||
onInput={(e: any) => setLocalValue(e.target.value)}
|
||||
placeholder={placeholder}
|
||||
placeholder={defaultPlaceholder}
|
||||
required={true}
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
value={localValue}>
|
||||
<span style={{ fontWeight: 500 }}>{providerName} API Key</span>
|
||||
<span style={{ fontWeight: 500 }}>
|
||||
{providerName} {t("settings.providers.apiKey")}
|
||||
</span>
|
||||
</VSCodeTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -43,7 +45,7 @@ export const ApiKeyField = ({
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{helpText || "This key is stored locally and only used to make API requests from this extension."}
|
||||
{defaultHelpText}
|
||||
{!localValue && signupUrl && (
|
||||
<VSCodeLink
|
||||
href={signupUrl}
|
||||
@@ -51,7 +53,8 @@ export const ApiKeyField = ({
|
||||
display: "inline",
|
||||
fontSize: "inherit",
|
||||
}}>
|
||||
You can get a{/^[aeiou]/i.test(providerName) ? "n" : ""} {providerName} API key by signing up here.
|
||||
{" "}
|
||||
{getApiKeyText}
|
||||
</VSCodeLink>
|
||||
)}
|
||||
</p>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { VSCodeCheckbox, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useDebouncedInput } from "../utils/useDebouncedInput"
|
||||
|
||||
/**
|
||||
@@ -21,11 +22,14 @@ interface BaseUrlFieldProps {
|
||||
export const BaseUrlField = ({
|
||||
initialValue,
|
||||
onChange,
|
||||
label = "Use custom base URL",
|
||||
placeholder = "Default: https://api.example.com",
|
||||
label,
|
||||
placeholder,
|
||||
disabled = false,
|
||||
showLockIcon = false,
|
||||
}: BaseUrlFieldProps) => {
|
||||
const { t } = useTranslation()
|
||||
const defaultLabel = label || t("settings.apiConfig.useCustomBaseUrl")
|
||||
const defaultPlaceholder = placeholder || "Default: https://api.example.com"
|
||||
const [isEnabled, setIsEnabled] = useState(!!initialValue)
|
||||
const [localValue, setLocalValue] = useDebouncedInput(initialValue || "", onChange)
|
||||
|
||||
@@ -41,7 +45,7 @@ export const BaseUrlField = ({
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<VSCodeCheckbox checked={isEnabled} disabled={disabled} onChange={handleToggle}>
|
||||
{label}
|
||||
{defaultLabel}
|
||||
</VSCodeCheckbox>
|
||||
{showLockIcon && <i className="codicon codicon-lock text-(--vscode-descriptionForeground) text-sm" />}
|
||||
</div>
|
||||
@@ -50,7 +54,7 @@ export const BaseUrlField = ({
|
||||
<VSCodeTextField
|
||||
disabled={disabled}
|
||||
onInput={(e: any) => setLocalValue(e.target.value.trim())}
|
||||
placeholder={placeholder}
|
||||
placeholder={defaultPlaceholder}
|
||||
style={{ width: "100%", marginTop: 3 }}
|
||||
type="text"
|
||||
value={localValue}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { anthropicModels, CLAUDE_SONNET_1M_SUFFIX } from "@shared/api"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { BaseUrlField } from "../common/BaseUrlField"
|
||||
@@ -36,6 +37,7 @@ interface AnthropicProviderProps {
|
||||
* The Anthropic provider configuration component
|
||||
*/
|
||||
export const AnthropicProvider = ({ showModelOptions, isPopup, currentMode }: AnthropicProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -58,7 +60,6 @@ export const AnthropicProvider = ({ showModelOptions, isPopup, currentMode }: An
|
||||
|
||||
<BaseUrlField
|
||||
initialValue={apiConfiguration?.anthropicBaseUrl}
|
||||
label="Use custom base URL"
|
||||
onChange={(value) => handleFieldChange("anthropicBaseUrl", value)}
|
||||
placeholder="Default: https://api.anthropic.com"
|
||||
/>
|
||||
@@ -66,7 +67,7 @@ export const AnthropicProvider = ({ showModelOptions, isPopup, currentMode }: An
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
label={t("settings.providers.model")}
|
||||
models={anthropicModels}
|
||||
onChange={(e) =>
|
||||
handleModeFieldChange(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { askSageDefaultURL, askSageModels, ModelInfo } from "@shared/api"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useEffect, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
@@ -22,6 +23,7 @@ interface AskSageProviderProps {
|
||||
* The AskSage provider configuration component
|
||||
*/
|
||||
export const AskSageProvider = ({ showModelOptions, isPopup, currentMode }: AskSageProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
const [availableModels, setAvailableModels] = useState<Record<string, ModelInfo>>(askSageModels)
|
||||
@@ -70,7 +72,7 @@ export const AskSageProvider = ({ showModelOptions, isPopup, currentMode }: AskS
|
||||
return (
|
||||
<div>
|
||||
<ApiKeyField
|
||||
helpText="This key is stored locally and only used to make API requests from this extension."
|
||||
helpText={t("settings.apiConfig.apiKeyStoredLocally")}
|
||||
initialValue={apiConfiguration?.asksageApiKey || ""}
|
||||
onChange={(value) => handleFieldChange("asksageApiKey", value)}
|
||||
providerName="AskSage"
|
||||
@@ -79,16 +81,16 @@ export const AskSageProvider = ({ showModelOptions, isPopup, currentMode }: AskS
|
||||
<DebouncedTextField
|
||||
initialValue={apiConfiguration?.asksageApiUrl || askSageDefaultURL}
|
||||
onChange={(value) => handleFieldChange("asksageApiUrl", value)}
|
||||
placeholder="Enter AskSage API URL..."
|
||||
placeholder={t("settings.apiConfig.enterAskSageApiUrl")}
|
||||
style={{ width: "100%" }}
|
||||
type="text">
|
||||
<span style={{ fontWeight: 500 }}>AskSage API URL</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.askSageApiUrl")}</span>
|
||||
</DebouncedTextField>
|
||||
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
label={t("settings.providers.model")}
|
||||
models={availableModels}
|
||||
onChange={(e) =>
|
||||
handleModeFieldChange(
|
||||
|
||||
@@ -3,6 +3,7 @@ import BedrockData from "@shared/providers/bedrock.json"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeCheckbox, VSCodeDropdown, VSCodeOption, VSCodeRadio, VSCodeRadioGroup } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
@@ -36,6 +37,7 @@ interface BedrockProviderProps {
|
||||
}
|
||||
|
||||
export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: BedrockProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration, remoteConfigSettings } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange, handleModeFieldsChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -51,9 +53,9 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
handleFieldChange("awsAuthentication", value)
|
||||
}}
|
||||
value={apiConfiguration?.awsAuthentication ?? (apiConfiguration?.awsProfile ? "profile" : "credentials")}>
|
||||
<VSCodeRadio value="apikey">API Key</VSCodeRadio>
|
||||
<VSCodeRadio value="profile">AWS Profile</VSCodeRadio>
|
||||
<VSCodeRadio value="credentials">AWS Credentials</VSCodeRadio>
|
||||
<VSCodeRadio value="apikey">{t("settings.providers.apiKey")}</VSCodeRadio>
|
||||
<VSCodeRadio value="profile">{t("settings.apiConfig.awsProfile")}</VSCodeRadio>
|
||||
<VSCodeRadio value="credentials">{t("settings.apiConfig.awsCredentials")}</VSCodeRadio>
|
||||
</VSCodeRadioGroup>
|
||||
|
||||
{(apiConfiguration?.awsAuthentication === undefined && apiConfiguration?.awsUseProfile) ||
|
||||
@@ -63,8 +65,8 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
initialValue={apiConfiguration?.awsProfile ?? ""}
|
||||
key="profile"
|
||||
onChange={(value) => handleFieldChange("awsProfile", value)}
|
||||
placeholder="Enter profile name (default if empty)">
|
||||
<span className="font-medium">AWS Profile Name</span>
|
||||
placeholder={t("settings.apiConfig.enterProfileName")}>
|
||||
<span className="font-medium">{t("settings.apiConfig.awsProfileName")}</span>
|
||||
</DebouncedTextField>
|
||||
) : apiConfiguration?.awsAuthentication === "apikey" ? (
|
||||
<DebouncedTextField
|
||||
@@ -72,9 +74,9 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
initialValue={apiConfiguration?.awsBedrockApiKey ?? ""}
|
||||
key="apikey"
|
||||
onChange={(value) => handleFieldChange("awsBedrockApiKey", value)}
|
||||
placeholder="Enter Bedrock Api Key"
|
||||
placeholder={t("settings.apiConfig.enterBedrockApiKey")}
|
||||
type="password">
|
||||
<span className="font-medium">AWS Bedrock Api Key</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.awsBedrockApiKey")}</span>
|
||||
</DebouncedTextField>
|
||||
) : (
|
||||
<>
|
||||
@@ -83,25 +85,25 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
initialValue={apiConfiguration?.awsAccessKey || ""}
|
||||
key="accessKey"
|
||||
onChange={(value) => handleFieldChange("awsAccessKey", value)}
|
||||
placeholder="Enter Access Key..."
|
||||
placeholder={t("settings.apiConfig.enterAccessKey")}
|
||||
type="password">
|
||||
<span className="font-medium">AWS Access Key</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.awsAccessKey")}</span>
|
||||
</DebouncedTextField>
|
||||
<DebouncedTextField
|
||||
className="w-full"
|
||||
initialValue={apiConfiguration?.awsSecretKey || ""}
|
||||
onChange={(value) => handleFieldChange("awsSecretKey", value)}
|
||||
placeholder="Enter Secret Key..."
|
||||
placeholder={t("settings.apiConfig.enterSecretKey")}
|
||||
type="password">
|
||||
<span className="font-medium">AWS Secret Key</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.awsSecretKey")}</span>
|
||||
</DebouncedTextField>
|
||||
<DebouncedTextField
|
||||
className="w-full"
|
||||
initialValue={apiConfiguration?.awsSessionToken || ""}
|
||||
onChange={(value) => handleFieldChange("awsSessionToken", value)}
|
||||
placeholder="Enter Session Token..."
|
||||
placeholder={t("settings.apiConfig.enterSessionToken")}
|
||||
type="password">
|
||||
<span className="font-medium">AWS Session Token</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.awsSessionToken")}</span>
|
||||
</DebouncedTextField>
|
||||
</>
|
||||
)}
|
||||
@@ -114,7 +116,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
<DropdownContainer className="dropdown-container mb-2.5" zIndex={DROPDOWN_Z_INDEX - 1}>
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<label htmlFor="aws-region-dropdown">
|
||||
<span className="font-medium">AWS Region</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.awsRegion")}</span>
|
||||
</label>
|
||||
{remoteConfigSettings?.awsRegion !== undefined && (
|
||||
<i className="codicon codicon-lock text-description text-sm flex items-center" />
|
||||
@@ -126,7 +128,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
id="aws-region-dropdown"
|
||||
onChange={(e: any) => handleFieldChange("awsRegion", e.target.value)}
|
||||
value={apiConfiguration?.awsRegion || ""}>
|
||||
<VSCodeOption value="">Select a region...</VSCodeOption>
|
||||
<VSCodeOption value="">{t("settings.apiConfig.selectRegion")}</VSCodeOption>
|
||||
{/* The user will have to choose a region that supports the model they use, but this shouldn't be a problem since they'd have to request access for it in that region in the first place. */}
|
||||
{AWS_REGIONS.map((region) => (
|
||||
<VSCodeOption key={region} value={region}>
|
||||
@@ -155,7 +157,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
handleFieldChange("awsBedrockEndpoint", "")
|
||||
}
|
||||
}}>
|
||||
Use custom VPC endpoint
|
||||
{t("settings.apiConfig.useCustomVpcEndpoint")}
|
||||
</VSCodeCheckbox>
|
||||
{remoteConfigSettings?.awsBedrockEndpoint !== undefined && (
|
||||
<i className="codicon codicon-lock text-description text-sm flex items-center" />
|
||||
@@ -168,7 +170,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
disabled={remoteConfigSettings?.awsBedrockEndpoint !== undefined}
|
||||
initialValue={apiConfiguration?.awsBedrockEndpoint || ""}
|
||||
onChange={(value) => handleFieldChange("awsBedrockEndpoint", value)}
|
||||
placeholder="Enter VPC Endpoint URL (optional)"
|
||||
placeholder={t("settings.apiConfig.enterVpcEndpointUrl")}
|
||||
type="text"
|
||||
/>
|
||||
)}
|
||||
@@ -189,7 +191,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
|
||||
handleFieldChange("awsUseCrossRegionInference", isChecked)
|
||||
}}>
|
||||
Use cross-region inference
|
||||
{t("settings.apiConfig.useCrossRegionInference")}
|
||||
</VSCodeCheckbox>
|
||||
{remoteConfigSettings?.awsUseCrossRegionInference !== undefined && (
|
||||
<i className="codicon codicon-lock text-description text-sm" />
|
||||
@@ -212,7 +214,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
const isChecked = e.target.checked === true
|
||||
handleFieldChange("awsUseGlobalInference", isChecked)
|
||||
}}>
|
||||
Use global inference profile
|
||||
{t("settings.apiConfig.useGlobalInferenceProfile")}
|
||||
</VSCodeCheckbox>
|
||||
{remoteConfigSettings?.awsUseGlobalInference !== undefined && (
|
||||
<i className="codicon codicon-lock text-description text-sm" />
|
||||
@@ -236,7 +238,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
const isChecked = e.target.checked === true
|
||||
handleFieldChange("awsBedrockUsePromptCache", isChecked)
|
||||
}}>
|
||||
Use prompt caching
|
||||
{t("settings.apiConfig.usePromptCaching")}
|
||||
</VSCodeCheckbox>
|
||||
{remoteConfigSettings?.awsBedrockUsePromptCache !== undefined && (
|
||||
<i className="codicon codicon-lock text-description text-sm" />
|
||||
@@ -249,14 +251,14 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
|
||||
<p className="mt-1 text-sm text-description">
|
||||
{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")}
|
||||
</p>
|
||||
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<label htmlFor="bedrock-model-dropdown">
|
||||
<span className="font-medium">Model</span>
|
||||
<span className="font-medium">{t("settings.providers.model")}</span>
|
||||
</label>
|
||||
<DropdownContainer className="dropdown-container" zIndex={DROPDOWN_Z_INDEX - 2}>
|
||||
<VSCodeDropdown
|
||||
@@ -286,7 +288,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
)
|
||||
}}
|
||||
value={modeFields.awsBedrockCustomSelected ? "custom" : selectedModelId}>
|
||||
<VSCodeOption value="">Select a model...</VSCodeOption>
|
||||
<VSCodeOption value="">{t("settings.apiConfig.selectModel")}</VSCodeOption>
|
||||
{Object.keys(bedrockModels).map((modelId) => (
|
||||
<VSCodeOption
|
||||
className="whitespace-normal wrap-break-word max-w-full"
|
||||
@@ -295,16 +297,13 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
{modelId}
|
||||
</VSCodeOption>
|
||||
))}
|
||||
<VSCodeOption value="custom">Custom</VSCodeOption>
|
||||
<VSCodeOption value="custom">{t("settings.apiConfig.custom")}</VSCodeOption>
|
||||
</VSCodeDropdown>
|
||||
</DropdownContainer>
|
||||
|
||||
{modeFields.awsBedrockCustomSelected && (
|
||||
<div>
|
||||
<p className="mt-1 text-sm text-description">
|
||||
Select "Custom" when using the Application Inference Profile in Bedrock. Enter the Application
|
||||
Inference Profile ARN in the Model ID field.
|
||||
</p>
|
||||
<p className="mt-1 text-sm text-description">{t("settings.apiConfig.customModelDescription")}</p>
|
||||
<DebouncedTextField
|
||||
className="w-full mt-0.5"
|
||||
id="bedrock-model-input"
|
||||
@@ -316,11 +315,11 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
currentMode,
|
||||
)
|
||||
}
|
||||
placeholder="Enter custom model ID...">
|
||||
<span className="font-medium">Model ID</span>
|
||||
placeholder={t("settings.apiConfig.enterCustomModelId")}>
|
||||
<span className="font-medium">{t("settings.apiConfig.modelId")}</span>
|
||||
</DebouncedTextField>
|
||||
<label htmlFor="bedrock-base-model-dropdown">
|
||||
<span className="font-medium">Base Inference Model</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.baseInferenceModel")}</span>
|
||||
</label>
|
||||
<DropdownContainer className="dropdown-container" zIndex={DROPDOWN_Z_INDEX - 3}>
|
||||
<VSCodeDropdown
|
||||
@@ -337,7 +336,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
|
||||
)
|
||||
}
|
||||
value={modeFields.awsBedrockCustomModelBaseId || bedrockDefaultModelId}>
|
||||
<VSCodeOption value="">Select a model...</VSCodeOption>
|
||||
<VSCodeOption value="">{t("settings.apiConfig.selectModel")}</VSCodeOption>
|
||||
{Object.keys(bedrockModels).map((modelId) => (
|
||||
<VSCodeOption
|
||||
className="whitespace-normal wrap-break-word max-w-full"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
import { ModelInfoView } from "../common/ModelInfoView"
|
||||
import { normalizeApiConfiguration } from "../utils/providerUtils"
|
||||
import { useApiConfigurationHandlers } from "../utils/useApiConfigurationHandlers"
|
||||
import { useDebouncedInput } from "../utils/useDebouncedInput"
|
||||
|
||||
interface DifyProviderProps {
|
||||
showModelOptions: boolean
|
||||
@@ -14,18 +14,10 @@ interface DifyProviderProps {
|
||||
}
|
||||
|
||||
export const DifyProvider = ({ showModelOptions, isPopup, currentMode }: DifyProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
// Use debounced input for proper state management
|
||||
const [baseUrlValue, setBaseUrlValue] = useDebouncedInput(apiConfiguration?.difyBaseUrl || "", (value) =>
|
||||
handleFieldChange("difyBaseUrl", value),
|
||||
)
|
||||
|
||||
const [apiKeyValue, setApiKeyValue] = useDebouncedInput(apiConfiguration?.difyApiKey || "", (value) =>
|
||||
handleFieldChange("difyApiKey", value),
|
||||
)
|
||||
|
||||
// Get the normalized configuration
|
||||
const { selectedModelId, selectedModelInfo } = normalizeApiConfiguration(apiConfiguration, currentMode)
|
||||
|
||||
@@ -37,10 +29,10 @@ export const DifyProvider = ({ showModelOptions, isPopup, currentMode }: DifyPro
|
||||
onChange={(value) => {
|
||||
handleFieldChange("difyBaseUrl", value)
|
||||
}}
|
||||
placeholder={"Enter base URL..."}
|
||||
placeholder={t("settings.apiConfig.enterBaseUrl")}
|
||||
style={{ width: "100%", marginBottom: 10 }}
|
||||
type="text">
|
||||
<span style={{ fontWeight: 500 }}>Base URL</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.baseUrl")}</span>
|
||||
</DebouncedTextField>
|
||||
|
||||
<ApiKeyField
|
||||
@@ -52,12 +44,9 @@ export const DifyProvider = ({ showModelOptions, isPopup, currentMode }: DifyPro
|
||||
/>
|
||||
|
||||
<div style={{ fontSize: "12px", color: "var(--vscode-descriptionForeground)", marginTop: "5px" }}>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>{t("settings.apiConfig.difyDescription")}</p>
|
||||
<p style={{ marginTop: "8px" }}>
|
||||
<strong>Note:</strong> The model selection is handled within your Dify application configuration.
|
||||
<strong>{t("settings.apiConfig.note")}</strong> {t("settings.apiConfig.difyNote")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { fireworksModels } from "@shared/api"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { ModelInfoView } from "../common/ModelInfoView"
|
||||
@@ -20,6 +21,7 @@ interface FireworksProviderProps {
|
||||
* The Fireworks provider configuration component
|
||||
*/
|
||||
export const FireworksProvider = ({ currentMode, isPopup, showModelOptions }: FireworksProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleModeFieldChange, handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -33,23 +35,27 @@ export const FireworksProvider = ({ currentMode, isPopup, showModelOptions }: Fi
|
||||
providerName="Fireworks"
|
||||
signupUrl="https://fireworks.ai/"
|
||||
/>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
models={fireworksModels}
|
||||
onChange={(e: any) => {
|
||||
handleModeFieldChange(
|
||||
{
|
||||
plan: "planModeFireworksModelId",
|
||||
act: "actModeFireworksModelId",
|
||||
},
|
||||
e.target.value,
|
||||
currentMode,
|
||||
)
|
||||
}}
|
||||
selectedModelId={selectedModelId}
|
||||
/>
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label={t("settings.providers.model")}
|
||||
models={fireworksModels}
|
||||
onChange={(e: any) => {
|
||||
handleModeFieldChange(
|
||||
{
|
||||
plan: "planModeFireworksModelId",
|
||||
act: "actModeFireworksModelId",
|
||||
},
|
||||
e.target.value,
|
||||
currentMode,
|
||||
)
|
||||
}}
|
||||
selectedModelId={selectedModelId}
|
||||
/>
|
||||
|
||||
<ModelInfoView isPopup={isPopup} modelInfo={selectedModelInfo} selectedModelId={selectedModelId} />
|
||||
<ModelInfoView isPopup={isPopup} modelInfo={selectedModelInfo} selectedModelId={selectedModelId} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { geminiModels } from "@shared/api"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { BaseUrlField } from "../common/BaseUrlField"
|
||||
@@ -31,6 +32,7 @@ interface GeminiProviderProps {
|
||||
* The Gemini provider configuration component
|
||||
*/
|
||||
export const GeminiProvider = ({ showModelOptions, isPopup, currentMode }: GeminiProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -51,7 +53,6 @@ export const GeminiProvider = ({ showModelOptions, isPopup, currentMode }: Gemin
|
||||
|
||||
<BaseUrlField
|
||||
initialValue={apiConfiguration?.geminiBaseUrl}
|
||||
label="Use custom base URL"
|
||||
onChange={(value) => handleFieldChange("geminiBaseUrl", value)}
|
||||
placeholder="Default: https://generativelanguage.googleapis.com"
|
||||
/>
|
||||
@@ -59,7 +60,7 @@ export const GeminiProvider = ({ showModelOptions, isPopup, currentMode }: Gemin
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
label={t("settings.providers.model")}
|
||||
models={geminiModels}
|
||||
onChange={(e: any) =>
|
||||
handleModeFieldChange(
|
||||
@@ -83,7 +84,7 @@ export const GeminiProvider = ({ showModelOptions, isPopup, currentMode }: Gemin
|
||||
{selectedModelInfo.thinkingConfig?.supportsThinkingLevel && (
|
||||
<DropdownContainer className="dropdown-container" style={{ marginTop: "8px" }} zIndex={1}>
|
||||
<label htmlFor="thinking-level">
|
||||
<span className="font-medium">Thinking Level</span>
|
||||
<span className="font-medium">{t("settings.apiConfig.thinkingLevel")}</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
className="w-full"
|
||||
@@ -96,8 +97,8 @@ export const GeminiProvider = ({ showModelOptions, isPopup, currentMode }: Gemin
|
||||
)
|
||||
}
|
||||
value={geminiThinkingLevel || "high"}>
|
||||
<VSCodeOption value="low">Low</VSCodeOption>
|
||||
<VSCodeOption value="high">High</VSCodeOption>
|
||||
<VSCodeOption value="low">{t("settings.apiConfig.low")}</VSCodeOption>
|
||||
<VSCodeOption value="high">{t("settings.apiConfig.high")}</VSCodeOption>
|
||||
</VSCodeDropdown>
|
||||
</DropdownContainer>
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
import HicapModelPicker from "../HicapModelPicker"
|
||||
@@ -17,6 +18,7 @@ interface HicapProviderProps {
|
||||
* The Hicap provider configuration component
|
||||
*/
|
||||
export const HicapProvider = ({ showModelOptions, isPopup, currentMode }: HicapProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration, refreshHicapModels } = useExtensionState()
|
||||
const { handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -31,7 +33,7 @@ export const HicapProvider = ({ showModelOptions, isPopup, currentMode }: HicapP
|
||||
refreshHicapModels()
|
||||
}
|
||||
}}
|
||||
placeholder="Enter API Key..."
|
||||
placeholder={t("settings.apiConfig.apiKeyPlaceholder")}
|
||||
style={{ width: "100%" }}
|
||||
type="password">
|
||||
<div
|
||||
@@ -42,7 +44,7 @@ export const HicapProvider = ({ showModelOptions, isPopup, currentMode }: HicapP
|
||||
width: "100%",
|
||||
margin: "10px 0 0 0",
|
||||
}}>
|
||||
<span style={{ fontWeight: 500 }}>Hicap API Key</span>
|
||||
<span style={{ fontWeight: 500 }}>Hicap {t("settings.providers.apiKey")}</span>
|
||||
</div>
|
||||
</DebouncedTextField>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
import { HuggingFaceModelPicker } from "../HuggingFaceModelPicker"
|
||||
import { normalizeApiConfiguration } from "../utils/providerUtils"
|
||||
import { useApiConfigurationHandlers } from "../utils/useApiConfigurationHandlers"
|
||||
|
||||
/**
|
||||
@@ -18,21 +18,19 @@ interface HuggingFaceProviderProps {
|
||||
* The Hugging Face provider configuration component
|
||||
*/
|
||||
export const HuggingFaceProvider = ({ showModelOptions, isPopup, currentMode }: HuggingFaceProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
// Get the normalized configuration
|
||||
const { selectedModelId, selectedModelInfo } = normalizeApiConfiguration(apiConfiguration, currentMode)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<DebouncedTextField
|
||||
initialValue={apiConfiguration?.huggingFaceApiKey || ""}
|
||||
onChange={(value) => handleFieldChange("huggingFaceApiKey", value)}
|
||||
placeholder="Enter API Key..."
|
||||
placeholder={t("settings.apiConfig.apiKeyPlaceholder")}
|
||||
style={{ width: "100%" }}
|
||||
type="password">
|
||||
<span style={{ fontWeight: 500 }}>Hugging Face API Key</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.huggingFaceApiKey")}</span>
|
||||
</DebouncedTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -40,11 +38,16 @@ export const HuggingFaceProvider = ({ showModelOptions, isPopup, currentMode }:
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
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{" "}
|
||||
<a href="https://huggingface.co/settings/tokens" rel="noopener noreferrer" target="_blank">
|
||||
Get your API key here
|
||||
</a>
|
||||
<Trans
|
||||
components={{
|
||||
apiKeyLink: (
|
||||
<a href="https://huggingface.co/settings/tokens" rel="noopener noreferrer" target="_blank">
|
||||
{t("settings.apiConfig.getHuggingFaceApiKey")}
|
||||
</a>
|
||||
),
|
||||
}}
|
||||
i18nKey="settings.apiConfig.huggingFaceDescription"
|
||||
/>
|
||||
</p>
|
||||
|
||||
{showModelOptions && <HuggingFaceModelPicker currentMode={currentMode} isPopup={isPopup} />}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Mode } from "@shared/storage/types"
|
||||
import { VSCodeDropdown, VSCodeLink, VSCodeOption, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { useInterval } from "react-use"
|
||||
import UseCustomPromptCheckbox from "@/components/settings/UseCustomPromptCheckbox"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
@@ -37,6 +38,7 @@ interface LMStudioApiModel {
|
||||
* The LM Studio provider configuration component
|
||||
*/
|
||||
export const LMStudioProvider = ({ currentMode }: LMStudioProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -96,12 +98,11 @@ export const LMStudioProvider = ({ currentMode }: LMStudioProviderProps) => {
|
||||
<div className="flex flex-col gap-2">
|
||||
<BaseUrlField
|
||||
initialValue={apiConfiguration?.lmStudioBaseUrl}
|
||||
label="Use custom base URL"
|
||||
onChange={(value) => handleFieldChange("lmStudioBaseUrl", value)}
|
||||
placeholder="Default: http://localhost:1234"
|
||||
/>
|
||||
|
||||
<div className="font-semibold">Model</div>
|
||||
<div className="font-semibold">{t("settings.providers.model")}</div>
|
||||
{lmStudioModels.length > 0 ? (
|
||||
<DropdownContainer className="dropdown-container" zIndex={10}>
|
||||
<VSCodeDropdown
|
||||
@@ -143,29 +144,36 @@ export const LMStudioProvider = ({ currentMode }: LMStudioProviderProps) => {
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="font-semibold">Context Window</div>
|
||||
<div className="font-semibold">{t("settings.apiConfig.contextWindow")}</div>
|
||||
<VSCodeTextField
|
||||
className="w-full pointer-events-none"
|
||||
disabled={true}
|
||||
title="Not editable - the value is returned by the connected endpoint"
|
||||
title={t("settings.apiConfig.notEditable")}
|
||||
value={String(currentLoadedContext ?? lmStudioMaxTokens ?? "0")}
|
||||
/>
|
||||
|
||||
<UseCustomPromptCheckbox providerId="lmstudio" />
|
||||
|
||||
<div className="text-xs text-description">
|
||||
LM Studio allows you to run models locally on your computer. For instructions on how to get started, see their
|
||||
<VSCodeLink href="https://lmstudio.ai/docs" style={{ display: "inline", fontSize: "inherit" }}>
|
||||
quickstart guide.
|
||||
</VSCodeLink>
|
||||
You will also need to start LM Studio's{" "}
|
||||
<VSCodeLink className="inline" href="https://lmstudio.ai/docs/basics/server">
|
||||
local server
|
||||
</VSCodeLink>{" "}
|
||||
feature with <code>lms server start</code> to use it with this extension.{" "}
|
||||
<Trans
|
||||
components={{
|
||||
quickstartLink: (
|
||||
<VSCodeLink href="https://lmstudio.ai/docs" style={{ display: "inline", fontSize: "inherit" }}>
|
||||
{t("settings.apiConfig.lmStudioQuickstartGuide")}
|
||||
</VSCodeLink>
|
||||
),
|
||||
localServerLink: (
|
||||
<VSCodeLink className="inline" href="https://lmstudio.ai/docs/basics/server">
|
||||
{t("settings.apiConfig.lmStudioLocalServer")}
|
||||
</VSCodeLink>
|
||||
),
|
||||
}}
|
||||
i18nKey="settings.apiConfig.lmStudioDescription"
|
||||
/>{" "}
|
||||
{t("settings.apiConfig.lmStudioServerStart")}{" "}
|
||||
<div className="text-error">
|
||||
<span className="font-semibold">Note:</span> Cline uses complex prompts and works best with Claude models.
|
||||
Less capable models may not work as expected.
|
||||
<span className="font-semibold">{t("settings.apiConfig.note")}</span>{" "}
|
||||
{t("settings.apiConfig.clineBestWithClaude")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { minimaxModels } from "@shared/api"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { ModelInfoView } from "../common/ModelInfoView"
|
||||
@@ -21,6 +22,7 @@ interface MinimaxProviderProps {
|
||||
* The Minimax AI Studio provider configuration component
|
||||
*/
|
||||
export const MinimaxProvider = ({ showModelOptions, isPopup, currentMode }: MinimaxProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -31,7 +33,7 @@ export const MinimaxProvider = ({ showModelOptions, isPopup, currentMode }: Mini
|
||||
<div>
|
||||
<DropdownContainer className="dropdown-container" style={{ position: "inherit" }}>
|
||||
<label htmlFor="minimax-entrypoint">
|
||||
<span style={{ fontWeight: 500, marginTop: 5 }}>MiniMax Entrypoint</span>
|
||||
<span style={{ fontWeight: 500, marginTop: 5 }}>{t("settings.apiConfig.minimaxEntrypoint")}</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
id="minimax-entrypoint"
|
||||
@@ -51,8 +53,7 @@ export const MinimaxProvider = ({ showModelOptions, isPopup, currentMode }: Mini
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
Select the API endpoint according to your region: <code>api.minimaxi.com</code> for China, or{" "}
|
||||
<code>api.minimax.io</code> for all other locations.
|
||||
{t("settings.apiConfig.minimaxEndpointDescription")}
|
||||
</p>
|
||||
<ApiKeyField
|
||||
initialValue={apiConfiguration?.minimaxApiKey || ""}
|
||||
@@ -68,7 +69,7 @@ export const MinimaxProvider = ({ showModelOptions, isPopup, currentMode }: Mini
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
label={t("settings.providers.model")}
|
||||
models={minimaxModels}
|
||||
onChange={(e: any) =>
|
||||
handleModeFieldChange(
|
||||
|
||||
@@ -2,6 +2,7 @@ import { moonshotModels } from "@shared/api"
|
||||
import { UpdateApiConfigurationRequestNew } from "@shared/proto/index.cline"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ModelsServiceClient } from "@/services/grpc-client"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
@@ -22,6 +23,7 @@ interface MoonshotProviderProps {
|
||||
* The Moonshot AI Studio provider configuration component
|
||||
*/
|
||||
export const MoonshotProvider = ({ showModelOptions, isPopup, currentMode }: MoonshotProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
|
||||
// Get the normalized configuration
|
||||
@@ -31,7 +33,7 @@ export const MoonshotProvider = ({ showModelOptions, isPopup, currentMode }: Moo
|
||||
<div>
|
||||
<DropdownContainer className="dropdown-container" style={{ position: "inherit" }}>
|
||||
<label htmlFor="moonshot-entrypoint">
|
||||
<span style={{ fontWeight: 500, marginTop: 5 }}>Moonshot Entrypoint</span>
|
||||
<span style={{ fontWeight: 500, marginTop: 5 }}>{t("settings.apiConfig.moonshotEntrypoint")}</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
id="moonshot-entrypoint"
|
||||
@@ -58,7 +60,7 @@ export const MoonshotProvider = ({ showModelOptions, isPopup, currentMode }: Moo
|
||||
</VSCodeDropdown>
|
||||
</DropdownContainer>
|
||||
<ApiKeyField
|
||||
helpText="This key is stored locally and only used to make API requests from this extension."
|
||||
helpText={t("settings.apiConfig.apiKeyStoredLocally")}
|
||||
initialValue={apiConfiguration?.moonshotApiKey || ""}
|
||||
onChange={async (value) => {
|
||||
await ModelsServiceClient.updateApiConfiguration(
|
||||
@@ -83,7 +85,7 @@ export const MoonshotProvider = ({ showModelOptions, isPopup, currentMode }: Moo
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
label={t("settings.providers.model")}
|
||||
models={moonshotModels}
|
||||
onChange={async (e: any) => {
|
||||
const value = e.target.value
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { nebiusModels } from "@shared/api"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { ModelInfoView } from "../common/ModelInfoView"
|
||||
@@ -20,6 +21,7 @@ interface NebiusProviderProps {
|
||||
* The Nebius AI Studio provider configuration component
|
||||
*/
|
||||
export const NebiusProvider = ({ showModelOptions, isPopup, currentMode }: NebiusProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -28,7 +30,7 @@ export const NebiusProvider = ({ showModelOptions, isPopup, currentMode }: Nebiu
|
||||
return (
|
||||
<div>
|
||||
<ApiKeyField
|
||||
helpText="This key is stored locally and only used to make API requests from this extension. (Note: Cline uses complex prompts and works best with Claude models. Less capable models may not work as expected.)"
|
||||
helpText={`${t("settings.apiConfig.apiKeyStoredLocally")} (${t("settings.apiConfig.note")} ${t("settings.apiConfig.clineBestWithClaude")})`}
|
||||
initialValue={apiConfiguration?.nebiusApiKey || ""}
|
||||
onChange={(value) => handleFieldChange("nebiusApiKey", value)}
|
||||
providerName="Nebius"
|
||||
@@ -38,7 +40,7 @@ export const NebiusProvider = ({ showModelOptions, isPopup, currentMode }: Nebiu
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<ModelSelector
|
||||
label="Model"
|
||||
label={t("settings.providers.model")}
|
||||
models={nebiusModels}
|
||||
onChange={(e: any) =>
|
||||
handleModeFieldChange(
|
||||
|
||||
@@ -2,6 +2,7 @@ import { StringRequest } from "@shared/proto/cline/common"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { useInterval } from "react-use"
|
||||
import UseCustomPromptCheckbox from "@/components/settings/UseCustomPromptCheckbox"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
@@ -25,7 +26,8 @@ interface OllamaProviderProps {
|
||||
/**
|
||||
* The Ollama provider configuration component
|
||||
*/
|
||||
export const OllamaProvider = ({ showModelOptions, isPopup, currentMode }: OllamaProviderProps) => {
|
||||
export const OllamaProvider = ({ showModelOptions, currentMode }: OllamaProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -60,40 +62,38 @@ export const OllamaProvider = ({ showModelOptions, isPopup, currentMode }: Ollam
|
||||
<div className="flex flex-col gap-2">
|
||||
<BaseUrlField
|
||||
initialValue={apiConfiguration?.ollamaBaseUrl}
|
||||
label="Use custom base URL"
|
||||
onChange={(value) => handleFieldChange("ollamaBaseUrl", value)}
|
||||
placeholder="Default: http://localhost:11434"
|
||||
/>
|
||||
|
||||
{apiConfiguration?.ollamaBaseUrl && (
|
||||
<ApiKeyField
|
||||
helpText="Optional API key for authenticated Ollama instances or cloud services. Leave empty for local installations."
|
||||
helpText={t("settings.apiConfig.optionalApiKey")}
|
||||
initialValue={apiConfiguration?.ollamaApiKey || ""}
|
||||
onChange={(value) => handleFieldChange("ollamaApiKey", value)}
|
||||
placeholder="Enter API Key (optional)..."
|
||||
placeholder={t("settings.apiConfig.enterApiKeyOptional")}
|
||||
providerName="Ollama"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Model selection - use filterable picker */}
|
||||
<label htmlFor="ollama-model-selection">
|
||||
<span className="font-semibold">Model</span>
|
||||
<span className="font-semibold">{t("settings.providers.model")}</span>
|
||||
</label>
|
||||
<OllamaModelPicker
|
||||
ollamaModels={ollamaModels}
|
||||
onModelChange={(modelId) => {
|
||||
handleModeFieldChange({ plan: "planModeOllamaModelId", act: "actModeOllamaModelId" }, modelId, currentMode)
|
||||
}}
|
||||
placeholder={ollamaModels.length > 0 ? "Search and select a model..." : "e.g. llama3.1"}
|
||||
placeholder={
|
||||
ollamaModels.length > 0 ? t("settings.apiConfig.searchAndSelectModel") : t("settings.apiConfig.modelExample")
|
||||
}
|
||||
selectedModelId={ollamaModelId || ""}
|
||||
/>
|
||||
|
||||
{/* Show status message based on model availability */}
|
||||
{ollamaModels.length === 0 && (
|
||||
<p className="text-sm mt-1 text-description italic">
|
||||
Unable to fetch models from Ollama server. Please ensure Ollama is running and accessible, or enter the model
|
||||
ID manually above.
|
||||
</p>
|
||||
<p className="text-sm mt-1 text-description italic">{t("settings.apiConfig.unableToFetchModels")}</p>
|
||||
)}
|
||||
|
||||
<DebouncedTextField
|
||||
@@ -101,7 +101,7 @@ export const OllamaProvider = ({ showModelOptions, isPopup, currentMode }: Ollam
|
||||
onChange={(v) => handleFieldChange("ollamaApiOptionsCtxNum", v || undefined)}
|
||||
placeholder={"e.g. 32768"}
|
||||
style={{ width: "100%" }}>
|
||||
<span className="font-semibold">Model Context Window</span>
|
||||
<span className="font-semibold">{t("settings.apiConfig.modelContextWindow")}</span>
|
||||
</DebouncedTextField>
|
||||
|
||||
{showModelOptions && (
|
||||
@@ -117,11 +117,9 @@ export const OllamaProvider = ({ showModelOptions, isPopup, currentMode }: Ollam
|
||||
}}
|
||||
placeholder="Default: 30000 (30 seconds)"
|
||||
style={{ width: "100%" }}>
|
||||
<span className="font-semibold">Request Timeout (ms)</span>
|
||||
<span className="font-semibold">{t("settings.apiConfig.requestTimeout")}</span>
|
||||
</DebouncedTextField>
|
||||
<p className="text-xs mt-0 text-description">
|
||||
Maximum time in milliseconds to wait for API responses before timing out.
|
||||
</p>
|
||||
<p className="text-xs mt-0 text-description">{t("settings.apiConfig.requestTimeoutDescription")}</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -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{" "}
|
||||
<VSCodeLink
|
||||
href="https://github.com/ollama/ollama/blob/main/README.md"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
quickstart guide.
|
||||
</VSCodeLink>{" "}
|
||||
<Trans
|
||||
components={{
|
||||
quickstartLink: (
|
||||
<VSCodeLink
|
||||
href="https://github.com/ollama/ollama/blob/main/README.md"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
{t("settings.apiConfig.quickstartGuide")}
|
||||
</VSCodeLink>
|
||||
),
|
||||
}}
|
||||
i18nKey="settings.apiConfig.ollamaDescription"
|
||||
/>{" "}
|
||||
<span style={{ color: "var(--vscode-errorForeground)" }}>
|
||||
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude models.
|
||||
Less capable models may not work as expected.)
|
||||
(<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.note")}</span>{" "}
|
||||
{t("settings.apiConfig.clineBestWithClaude")})
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { OpenAiModelsRequest } from "@shared/proto/cline/models"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeButton, VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useCallback, useEffect, useRef, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Tooltip } from "@/components/ui/tooltip"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ModelsServiceClient } from "@/services/grpc-client"
|
||||
@@ -28,6 +29,7 @@ interface OpenAICompatibleProviderProps {
|
||||
* The OpenAI Compatible provider configuration component
|
||||
*/
|
||||
export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMode }: OpenAICompatibleProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration, remoteConfigSettings } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -75,7 +77,7 @@ export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMod
|
||||
<TooltipTrigger>
|
||||
<div className="mb-2.5">
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<span style={{ fontWeight: 500 }}>Base URL</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.baseUrl")}</span>
|
||||
{remoteConfigSettings?.openAiBaseUrl !== undefined && (
|
||||
<i className="codicon codicon-lock text-description text-sm" />
|
||||
)}
|
||||
@@ -87,14 +89,14 @@ export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMod
|
||||
handleFieldChange("openAiBaseUrl", value)
|
||||
debouncedRefreshOpenAiModels(value, apiConfiguration?.openAiApiKey)
|
||||
}}
|
||||
placeholder={"Enter base URL..."}
|
||||
placeholder={t("settings.apiConfig.enterBaseUrl")}
|
||||
style={{ width: "100%", marginBottom: 10 }}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent hidden={remoteConfigSettings?.openAiBaseUrl === undefined}>
|
||||
This setting is managed by your organization's remote configuration
|
||||
{t("settings.apiConfig.remoteConfigManaged")}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
@@ -112,9 +114,9 @@ export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMod
|
||||
onChange={(value) =>
|
||||
handleModeFieldChange({ plan: "planModeOpenAiModelId", act: "actModeOpenAiModelId" }, value, currentMode)
|
||||
}
|
||||
placeholder={"Enter Model ID..."}
|
||||
placeholder={t("settings.apiConfig.enterModelId")}
|
||||
style={{ width: "100%", marginBottom: 10 }}>
|
||||
<span style={{ fontWeight: 500 }}>Model ID</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.modelId")}</span>
|
||||
</DebouncedTextField>
|
||||
|
||||
{/* OpenAI Compatible Custom Headers */}
|
||||
@@ -134,7 +136,7 @@ export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMod
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent hidden={remoteConfigSettings?.openAiHeaders === undefined}>
|
||||
This setting is managed by your organization's remote configuration
|
||||
{t("settings.apiConfig.remoteConfigManaged")}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<VSCodeButton
|
||||
@@ -151,8 +153,8 @@ export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMod
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{headerEntries.map(([key, value], index) => (
|
||||
<div key={index} style={{ display: "flex", gap: 5, marginTop: 5 }}>
|
||||
{headerEntries.map(([key, value]) => (
|
||||
<div key={key} style={{ display: "flex", gap: 5, marginTop: 5 }}>
|
||||
<DebouncedTextField
|
||||
disabled={remoteConfigSettings?.openAiHeaders !== undefined}
|
||||
initialValue={key}
|
||||
@@ -209,7 +211,7 @@ export const OpenAICompatibleProvider = ({ showModelOptions, isPopup, currentMod
|
||||
showLockIcon={true}
|
||||
/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>This setting is managed by your organization's remote configuration</TooltipContent>
|
||||
<TooltipContent>{t("settings.apiConfig.remoteConfigManaged")}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<BaseUrlField
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { EmptyRequest } from "@shared/proto/cline/common"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { AccountServiceClient } from "@/services/grpc-client"
|
||||
import { useOpenRouterKeyInfo } from "../../ui/hooks/useOpenRouterKeyInfo"
|
||||
@@ -58,6 +59,7 @@ interface OpenRouterProviderProps {
|
||||
* The OpenRouter provider configuration component
|
||||
*/
|
||||
export const OpenRouterProvider = ({ showModelOptions, isPopup, currentMode }: OpenRouterProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -67,11 +69,11 @@ export const OpenRouterProvider = ({ showModelOptions, isPopup, currentMode }: O
|
||||
<DebouncedTextField
|
||||
initialValue={apiConfiguration?.openRouterApiKey || ""}
|
||||
onChange={(value) => handleFieldChange("openRouterApiKey", value)}
|
||||
placeholder="Enter API Key..."
|
||||
placeholder={t("settings.apiConfig.apiKeyPlaceholder")}
|
||||
style={{ width: "100%" }}
|
||||
type="password">
|
||||
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", width: "100%" }}>
|
||||
<span style={{ fontWeight: 500 }}>OpenRouter API Key</span>
|
||||
<span style={{ fontWeight: 500 }}>OpenRouter {t("settings.providers.apiKey")}</span>
|
||||
{apiConfiguration?.openRouterApiKey && (
|
||||
<OpenRouterBalanceDisplay apiKey={apiConfiguration.openRouterApiKey} />
|
||||
)}
|
||||
@@ -88,7 +90,7 @@ export const OpenRouterProvider = ({ showModelOptions, isPopup, currentMode }: O
|
||||
}
|
||||
}}
|
||||
style={{ margin: "5px 0 0 0" }}>
|
||||
Get OpenRouter API Key
|
||||
{t("settings.apiConfig.getOpenRouterApiKey")}
|
||||
</VSCodeButton>
|
||||
)}
|
||||
<p
|
||||
@@ -97,15 +99,11 @@ export const OpenRouterProvider = ({ showModelOptions, isPopup, currentMode }: O
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
This key is stored locally and only used to make API requests from this extension.
|
||||
{t("settings.apiConfig.apiKeyStoredLocally")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<OpenRouterModelPicker currentMode={currentMode} isPopup={isPopup} showProviderRouting={true} />
|
||||
</>
|
||||
)}
|
||||
{showModelOptions && <OpenRouterModelPicker currentMode={currentMode} isPopup={isPopup} showProviderRouting={true} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { StringRequest } from "@shared/proto/cline/common"
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeButton, VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
|
||||
import { useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { AccountServiceClient } from "@/services/grpc-client"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
@@ -23,6 +24,7 @@ interface RequestyProviderProps {
|
||||
* The Requesty provider configuration component
|
||||
*/
|
||||
export const RequestyProvider = ({ showModelOptions, isPopup, currentMode }: RequestyProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -54,7 +56,7 @@ export const RequestyProvider = ({ showModelOptions, isPopup, currentMode }: Req
|
||||
}
|
||||
}}
|
||||
style={{ margin: "5px 0 0 0" }}>
|
||||
Get Requesty API Key
|
||||
{t("settings.apiConfig.getRequestyApiKey")}
|
||||
</VSCodeButton>
|
||||
)}
|
||||
<VSCodeCheckbox
|
||||
@@ -67,7 +69,7 @@ export const RequestyProvider = ({ showModelOptions, isPopup, currentMode }: Req
|
||||
handleFieldChange("requestyBaseUrl", undefined)
|
||||
}
|
||||
}}>
|
||||
Use custom base URL
|
||||
{t("settings.apiConfig.useCustomBaseUrl")}
|
||||
</VSCodeCheckbox>
|
||||
{requestyEndpointSelected && (
|
||||
<DebouncedTextField
|
||||
@@ -79,7 +81,7 @@ export const RequestyProvider = ({ showModelOptions, isPopup, currentMode }: Req
|
||||
handleFieldChange("requestyBaseUrl", value)
|
||||
}
|
||||
}}
|
||||
placeholder="Custom base URL"
|
||||
placeholder={t("settings.apiConfig.customBaseUrl")}
|
||||
style={{ width: "100%", marginBottom: 5 }}
|
||||
type="text"
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { ApiKeyField } from "../common/ApiKeyField"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
@@ -17,7 +18,8 @@ interface TogetherProviderProps {
|
||||
/**
|
||||
* The Together provider configuration component
|
||||
*/
|
||||
export const TogetherProvider = ({ showModelOptions, isPopup, currentMode }: TogetherProviderProps) => {
|
||||
export const TogetherProvider = ({ currentMode }: TogetherProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange, handleModeFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -35,9 +37,9 @@ export const TogetherProvider = ({ showModelOptions, isPopup, currentMode }: Tog
|
||||
onChange={(value) =>
|
||||
handleModeFieldChange({ plan: "planModeTogetherModelId", act: "actModeTogetherModelId" }, value, currentMode)
|
||||
}
|
||||
placeholder={"Enter Model ID..."}
|
||||
placeholder={t("settings.apiConfig.enterModelId")}
|
||||
style={{ width: "100%" }}>
|
||||
<span style={{ fontWeight: 500 }}>Model ID</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.modelId")}</span>
|
||||
</DebouncedTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -46,8 +48,8 @@ export const TogetherProvider = ({ showModelOptions, isPopup, currentMode }: Tog
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
<span style={{ color: "var(--vscode-errorForeground)" }}>
|
||||
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude models.
|
||||
Less capable models may not work as expected.)
|
||||
(<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.note")}</span>{" "}
|
||||
{t("settings.apiConfig.clineBestWithClaude")})
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Mode } from "@shared/storage/types"
|
||||
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { DebouncedTextField } from "../common/DebouncedTextField"
|
||||
import OpenRouterModelPicker from "../OpenRouterModelPicker"
|
||||
@@ -18,6 +19,7 @@ interface VercelAIGatewayProviderProps {
|
||||
* The Vercel AI Gateway provider configuration component
|
||||
*/
|
||||
export const VercelAIGatewayProvider = ({ showModelOptions, isPopup, currentMode }: VercelAIGatewayProviderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const { handleFieldChange } = useApiConfigurationHandlers()
|
||||
|
||||
@@ -27,10 +29,10 @@ export const VercelAIGatewayProvider = ({ showModelOptions, isPopup, currentMode
|
||||
<DebouncedTextField
|
||||
initialValue={apiConfiguration?.vercelAiGatewayApiKey || ""}
|
||||
onChange={(value) => handleFieldChange("vercelAiGatewayApiKey", value)}
|
||||
placeholder="Enter API Key..."
|
||||
placeholder={t("settings.apiConfig.apiKeyPlaceholder")}
|
||||
style={{ width: "100%" }}
|
||||
type="password">
|
||||
<span style={{ fontWeight: 500 }}>Vercel AI Gateway API Key</span>
|
||||
<span style={{ fontWeight: 500 }}>{t("settings.apiConfig.vercelAiGatewayApiKey")}</span>
|
||||
</DebouncedTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -38,26 +40,28 @@ export const VercelAIGatewayProvider = ({ showModelOptions, isPopup, currentMode
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
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{" "}
|
||||
<VSCodeLink
|
||||
href="https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
signing up here.
|
||||
</VSCodeLink>
|
||||
<Trans
|
||||
components={{
|
||||
signupLink: (
|
||||
<VSCodeLink
|
||||
href="https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
{t("settings.apiConfig.signingUpHere")}
|
||||
</VSCodeLink>
|
||||
),
|
||||
}}
|
||||
i18nKey="settings.apiConfig.getVercelAiGatewayApiKey"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{showModelOptions && (
|
||||
<>
|
||||
<OpenRouterModelPicker currentMode={currentMode} isPopup={isPopup} />
|
||||
</>
|
||||
)}
|
||||
{showModelOptions && <OpenRouterModelPicker currentMode={currentMode} isPopup={isPopup} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -278,6 +278,78 @@
|
||||
"configureInSettings": "Configure in settings",
|
||||
"noModelsFound": "No models found",
|
||||
"projectIdPlaceholder": "Enter Project ID...",
|
||||
"apiKeyPlaceholder": "Enter API Key...",
|
||||
"apiKeyStoredLocally": "This key is stored locally and only used to make API requests from this extension.",
|
||||
"getApiKey": "You can get a {providerName} API key by signing up here.",
|
||||
"getApiKeyAn": "You can get an {providerName} API key by signing up here.",
|
||||
"useCustomBaseUrl": "Use custom base URL",
|
||||
"enterModelId": "Enter Model ID...",
|
||||
"modelId": "Model ID",
|
||||
"baseUrl": "Base URL",
|
||||
"enterBaseUrl": "Enter base URL...",
|
||||
"note": "Note:",
|
||||
"clineBestWithClaude": "Cline uses complex prompts and works best with Claude models. Less capable models may not work as expected.",
|
||||
"getOpenRouterApiKey": "Get OpenRouter API Key",
|
||||
"getRequestyApiKey": "Get Requesty API Key",
|
||||
"thinkingLevel": "Thinking Level",
|
||||
"low": "Low",
|
||||
"high": "High",
|
||||
"customBaseUrl": "Custom base URL",
|
||||
"optionalApiKey": "Optional API key for authenticated Ollama instances or cloud services. Leave empty for local installations.",
|
||||
"enterApiKeyOptional": "Enter API Key (optional)...",
|
||||
"searchAndSelectModel": "Search and select a model...",
|
||||
"modelExample": "e.g. llama3.1",
|
||||
"unableToFetchModels": "Unable to fetch models from Ollama server. Please ensure Ollama is running and accessible, or enter the model ID manually above.",
|
||||
"modelContextWindow": "Model Context Window",
|
||||
"requestTimeout": "Request Timeout (ms)",
|
||||
"requestTimeoutDescription": "Maximum time in milliseconds to wait for API responses before timing out.",
|
||||
"ollamaDescription": "Ollama allows you to run models locally on your computer. For instructions on how to get started, see their <quickstartLink></quickstartLink>",
|
||||
"quickstartGuide": "quickstart guide",
|
||||
"awsProfile": "AWS Profile",
|
||||
"awsCredentials": "AWS Credentials",
|
||||
"awsProfileName": "AWS Profile Name",
|
||||
"enterProfileName": "Enter profile name (default if empty)",
|
||||
"enterBedrockApiKey": "Enter Bedrock Api Key",
|
||||
"awsBedrockApiKey": "AWS Bedrock Api Key",
|
||||
"awsAccessKey": "AWS Access Key",
|
||||
"enterAccessKey": "Enter Access Key...",
|
||||
"awsSecretKey": "AWS Secret Key",
|
||||
"enterSecretKey": "Enter Secret Key...",
|
||||
"awsSessionToken": "AWS Session Token",
|
||||
"enterSessionToken": "Enter Session Token...",
|
||||
"awsRegion": "AWS Region",
|
||||
"selectRegion": "Select a region...",
|
||||
"useCustomVpcEndpoint": "Use custom VPC endpoint",
|
||||
"enterVpcEndpointUrl": "Enter VPC Endpoint URL (optional)",
|
||||
"useCrossRegionInference": "Use cross-region inference",
|
||||
"useGlobalInferenceProfile": "Use global inference profile",
|
||||
"usePromptCaching": "Use prompt caching",
|
||||
"awsProfileDescription": "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.",
|
||||
"awsCredentialsDescription": "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.",
|
||||
"selectModel": "Select a model...",
|
||||
"custom": "Custom",
|
||||
"customModelDescription": "Select \"Custom\" when using the Application Inference Profile in Bedrock. Enter the Application Inference Profile ARN in the Model ID field.",
|
||||
"enterCustomModelId": "Enter custom model ID...",
|
||||
"baseInferenceModel": "Base Inference Model",
|
||||
"contextWindow": "Context Window",
|
||||
"notEditable": "Not editable - the value is returned by the connected endpoint",
|
||||
"lmStudioDescription": "LM Studio allows you to run models locally on your computer. For instructions on how to get started, see their <quickstartLink></quickstartLink> You will also need to start LM Studio's <localServerLink></localServerLink>",
|
||||
"lmStudioQuickstartGuide": "quickstart guide",
|
||||
"lmStudioLocalServer": "local server",
|
||||
"lmStudioServerStart": "feature with lms server start to use it with this extension.",
|
||||
"huggingFaceApiKey": "Hugging Face API Key",
|
||||
"huggingFaceDescription": "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 <apiKeyLink></apiKeyLink>",
|
||||
"getHuggingFaceApiKey": "Get your API key here",
|
||||
"difyDescription": "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.",
|
||||
"difyNote": "The model selection is handled within your Dify application configuration.",
|
||||
"minimaxEntrypoint": "MiniMax Entrypoint",
|
||||
"minimaxEndpointDescription": "Select the API endpoint according to your region: api.minimaxi.com for China, or api.minimax.io for all other locations.",
|
||||
"moonshotEntrypoint": "Moonshot Entrypoint",
|
||||
"askSageApiUrl": "AskSage API URL",
|
||||
"enterAskSageApiUrl": "Enter AskSage API URL...",
|
||||
"vercelAiGatewayApiKey": "Vercel AI Gateway API Key",
|
||||
"getVercelAiGatewayApiKey": "You can get a Vercel AI Gateway API key by <signupLink></signupLink>",
|
||||
"signingUpHere": "signing up here",
|
||||
"providerHelpText": {
|
||||
"lmstudio": "Start LM Studio and load a model to begin",
|
||||
"ollama": "Run `ollama serve` and pull a model",
|
||||
|
||||
@@ -278,6 +278,78 @@
|
||||
"configureInSettings": "在设置中配置",
|
||||
"noModelsFound": "未找到模型",
|
||||
"projectIdPlaceholder": "输入项目 ID...",
|
||||
"apiKeyPlaceholder": "输入 API 密钥...",
|
||||
"apiKeyStoredLocally": "此密钥存储在本地,仅用于从此扩展程序发出 API 请求。",
|
||||
"getApiKey": "您可以通过在此处注册获取 {providerName} API 密钥。",
|
||||
"getApiKeyAn": "您可以通过在此处注册获取 {providerName} API 密钥。",
|
||||
"useCustomBaseUrl": "使用自定义基础 URL",
|
||||
"enterModelId": "输入模型 ID...",
|
||||
"modelId": "模型 ID",
|
||||
"baseUrl": "基础 URL",
|
||||
"enterBaseUrl": "输入基础 URL...",
|
||||
"note": "注意:",
|
||||
"clineBestWithClaude": "Cline 使用复杂的提示,最适合与 Claude 模型配合使用。能力较弱的模型可能无法按预期工作。",
|
||||
"getOpenRouterApiKey": "获取 OpenRouter API 密钥",
|
||||
"getRequestyApiKey": "获取 Requesty API 密钥",
|
||||
"thinkingLevel": "思考层级",
|
||||
"low": "低",
|
||||
"high": "高",
|
||||
"customBaseUrl": "自定义基础 URL",
|
||||
"optionalApiKey": "用于经过身份验证的 Ollama 实例或云服务的可选 API 密钥。对于本地安装,请留空。",
|
||||
"enterApiKeyOptional": "输入 API 密钥(可选)...",
|
||||
"searchAndSelectModel": "搜索并选择模型...",
|
||||
"modelExample": "例如:llama3.1",
|
||||
"unableToFetchModels": "无法从 Ollama 服务器获取模型。请确保 Ollama 正在运行且可访问,或在上方手动输入模型 ID。",
|
||||
"modelContextWindow": "模型上下文窗口",
|
||||
"requestTimeout": "请求超时(毫秒)",
|
||||
"requestTimeoutDescription": "在超时之前等待 API 响应的最大时间(以毫秒为单位)。",
|
||||
"ollamaDescription": "Ollama 允许您在本地计算机上运行模型。有关如何开始的说明,请参阅其 <quickstartLink></quickstartLink>",
|
||||
"quickstartGuide": "快速入门指南",
|
||||
"awsProfile": "AWS 配置文件",
|
||||
"awsCredentials": "AWS 凭据",
|
||||
"awsProfileName": "AWS 配置文件名称",
|
||||
"enterProfileName": "输入配置文件名称(如果为空则使用默认值)",
|
||||
"enterBedrockApiKey": "输入 Bedrock API 密钥",
|
||||
"awsBedrockApiKey": "AWS Bedrock API 密钥",
|
||||
"awsAccessKey": "AWS 访问密钥",
|
||||
"enterAccessKey": "输入访问密钥...",
|
||||
"awsSecretKey": "AWS 密钥",
|
||||
"enterSecretKey": "输入密钥...",
|
||||
"awsSessionToken": "AWS 会话令牌",
|
||||
"enterSessionToken": "输入会话令牌...",
|
||||
"awsRegion": "AWS 区域",
|
||||
"selectRegion": "选择区域...",
|
||||
"useCustomVpcEndpoint": "使用自定义 VPC 端点",
|
||||
"enterVpcEndpointUrl": "输入 VPC 端点 URL(可选)",
|
||||
"useCrossRegionInference": "使用跨区域推理",
|
||||
"useGlobalInferenceProfile": "使用全局推理配置文件",
|
||||
"usePromptCaching": "使用提示缓存",
|
||||
"awsProfileDescription": "使用来自 ~/.aws/credentials 的 AWS 配置文件凭据。如果配置文件名称为空,则使用默认配置文件。这些凭据仅在本地用于从此扩展程序发出 API 请求。",
|
||||
"awsCredentialsDescription": "通过提供上述密钥或使用默认的 AWS 凭据提供程序(即 ~/.aws/credentials 或环境变量)进行身份验证。这些凭据仅在本地用于从此扩展程序发出 API 请求。",
|
||||
"selectModel": "选择模型...",
|
||||
"custom": "自定义",
|
||||
"customModelDescription": "在 Bedrock 中使用应用程序推理配置文件时选择\"自定义\"。在模型 ID 字段中输入应用程序推理配置文件 ARN。",
|
||||
"enterCustomModelId": "输入自定义模型 ID...",
|
||||
"baseInferenceModel": "基础推理模型",
|
||||
"contextWindow": "上下文窗口",
|
||||
"notEditable": "不可编辑 - 该值由连接的端点返回",
|
||||
"lmStudioDescription": "LM Studio 允许您在本地计算机上运行模型。有关如何开始的说明,请参阅其 <quickstartLink></quickstartLink> 您还需要启动 LM Studio 的 <localServerLink></localServerLink>",
|
||||
"lmStudioQuickstartGuide": "快速入门指南",
|
||||
"lmStudioLocalServer": "本地服务器",
|
||||
"lmStudioServerStart": "功能(使用 lms server start 启动)以与此扩展程序一起使用。",
|
||||
"huggingFaceApiKey": "Hugging Face API 密钥",
|
||||
"huggingFaceDescription": "此密钥存储在本地,仅用于从此扩展程序发出 API 请求。我们在此不显示定价,因为它取决于您的 Hugging Face 提供商设置,并且无法通过其 API 一致地获取 <apiKeyLink></apiKeyLink>",
|
||||
"getHuggingFaceApiKey": "在此处获取您的 API 密钥",
|
||||
"difyDescription": "Dify 是一个通过统一 API 提供对各种 AI 模型访问的平台。配置您的 Dify 实例 URL 和 API 密钥以开始使用。",
|
||||
"difyNote": "模型选择在您的 Dify 应用程序配置中处理。",
|
||||
"minimaxEntrypoint": "MiniMax 入口点",
|
||||
"minimaxEndpointDescription": "根据您的区域选择 API 端点:中国使用 api.minimaxi.com,其他所有地区使用 api.minimax.io。",
|
||||
"moonshotEntrypoint": "Moonshot 入口点",
|
||||
"askSageApiUrl": "AskSage API URL",
|
||||
"enterAskSageApiUrl": "输入 AskSage API URL...",
|
||||
"vercelAiGatewayApiKey": "Vercel AI Gateway API 密钥",
|
||||
"getVercelAiGatewayApiKey": "您可以通过 <signupLink></signupLink> 获取 Vercel AI Gateway API 密钥",
|
||||
"signingUpHere": "在此处注册",
|
||||
"providerHelpText": {
|
||||
"lmstudio": "启动 LM Studio 并加载模型以开始",
|
||||
"ollama": "运行 `ollama serve` 并拉取模型",
|
||||
|
||||
Reference in new issue
Block a user