|
|
@@ -34,7 +34,6 @@ import {
|
|
|
requestyDefaultModelInfo,
|
|
|
} from "../../../../src/shared/api"
|
|
|
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
|
|
|
-import { useExtensionState } from "../../context/ExtensionStateContext"
|
|
|
import { vscode } from "../../utils/vscode"
|
|
|
import VSCodeButtonLink from "../common/VSCodeButtonLink"
|
|
|
import { OpenRouterModelPicker } from "./OpenRouterModelPicker"
|
|
|
@@ -46,13 +45,22 @@ import { DROPDOWN_Z_INDEX } from "./styles"
|
|
|
import { RequestyModelPicker } from "./RequestyModelPicker"
|
|
|
|
|
|
interface ApiOptionsProps {
|
|
|
+ uriScheme: string | undefined
|
|
|
+ apiConfiguration: ApiConfiguration | undefined
|
|
|
+ setApiConfigurationField: <K extends keyof ApiConfiguration>(field: K, value: ApiConfiguration[K]) => void
|
|
|
apiErrorMessage?: string
|
|
|
modelIdErrorMessage?: string
|
|
|
fromWelcomeView?: boolean
|
|
|
}
|
|
|
|
|
|
-const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: ApiOptionsProps) => {
|
|
|
- const { apiConfiguration, uriScheme, handleInputChange } = useExtensionState()
|
|
|
+const ApiOptions = ({
|
|
|
+ uriScheme,
|
|
|
+ apiConfiguration,
|
|
|
+ setApiConfigurationField,
|
|
|
+ apiErrorMessage,
|
|
|
+ modelIdErrorMessage,
|
|
|
+ fromWelcomeView,
|
|
|
+}: ApiOptionsProps) => {
|
|
|
const [ollamaModels, setOllamaModels] = useState<string[]>([])
|
|
|
const [lmStudioModels, setLmStudioModels] = useState<string[]>([])
|
|
|
const [vsCodeLmModels, setVsCodeLmModels] = useState<vscodemodels.LanguageModelChatSelector[]>([])
|
|
|
@@ -61,6 +69,21 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
const [openRouterBaseUrlSelected, setOpenRouterBaseUrlSelected] = useState(!!apiConfiguration?.openRouterBaseUrl)
|
|
|
const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false)
|
|
|
|
|
|
+ const inputEventTransform = <E,>(event: E) => (event as { target: HTMLInputElement })?.target?.value as any
|
|
|
+ const noTransform = <T,>(value: T) => value
|
|
|
+ const dropdownEventTransform = <T,>(event: DropdownOption | string | undefined) =>
|
|
|
+ (typeof event == "string" ? event : event?.value) as T
|
|
|
+ const handleInputChange = useCallback(
|
|
|
+ <K extends keyof ApiConfiguration, E>(
|
|
|
+ field: K,
|
|
|
+ transform: (event: E) => ApiConfiguration[K] = inputEventTransform,
|
|
|
+ ) =>
|
|
|
+ (event: E | Event) => {
|
|
|
+ setApiConfigurationField(field, transform(event as E))
|
|
|
+ },
|
|
|
+ [setApiConfigurationField],
|
|
|
+ )
|
|
|
+
|
|
|
const { selectedProvider, selectedModelId, selectedModelInfo } = useMemo(() => {
|
|
|
return normalizeApiConfiguration(apiConfiguration)
|
|
|
}, [apiConfiguration])
|
|
|
@@ -115,12 +138,8 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
<Dropdown
|
|
|
id="model-id"
|
|
|
value={selectedModelId}
|
|
|
- onChange={(value: unknown) => {
|
|
|
- handleInputChange("apiModelId")({
|
|
|
- target: {
|
|
|
- value: (value as DropdownOption).value,
|
|
|
- },
|
|
|
- })
|
|
|
+ onChange={(value) => {
|
|
|
+ setApiConfigurationField("apiModelId", typeof value == "string" ? value : value?.value)
|
|
|
}}
|
|
|
style={{ width: "100%" }}
|
|
|
options={options}
|
|
|
@@ -137,13 +156,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
<Dropdown
|
|
|
id="api-provider"
|
|
|
value={selectedProvider}
|
|
|
- onChange={(value: unknown) => {
|
|
|
- handleInputChange("apiProvider")({
|
|
|
- target: {
|
|
|
- value: (value as DropdownOption).value,
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("apiProvider", dropdownEventTransform)}
|
|
|
style={{ minWidth: 130, position: "relative", zIndex: DROPDOWN_Z_INDEX + 1 }}
|
|
|
options={[
|
|
|
{ value: "openrouter", label: "OpenRouter" },
|
|
|
@@ -181,11 +194,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
onChange={(checked: boolean) => {
|
|
|
setAnthropicBaseUrlSelected(checked)
|
|
|
if (!checked) {
|
|
|
- handleInputChange("anthropicBaseUrl")({
|
|
|
- target: {
|
|
|
- value: "",
|
|
|
- },
|
|
|
- })
|
|
|
+ setApiConfigurationField("anthropicBaseUrl", "")
|
|
|
}
|
|
|
}}>
|
|
|
Use custom base URL
|
|
|
@@ -384,11 +393,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
onChange={(checked: boolean) => {
|
|
|
setOpenRouterBaseUrlSelected(checked)
|
|
|
if (!checked) {
|
|
|
- handleInputChange("openRouterBaseUrl")({
|
|
|
- target: {
|
|
|
- value: "",
|
|
|
- },
|
|
|
- })
|
|
|
+ setApiConfigurationField("openRouterBaseUrl", "")
|
|
|
}
|
|
|
}}>
|
|
|
Use custom base URL
|
|
|
@@ -405,11 +410,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
)}
|
|
|
<Checkbox
|
|
|
checked={apiConfiguration?.openRouterUseMiddleOutTransform || false}
|
|
|
- onChange={(checked: boolean) => {
|
|
|
- handleInputChange("openRouterUseMiddleOutTransform")({
|
|
|
- target: { value: checked },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange("openRouterUseMiddleOutTransform", noTransform)}>
|
|
|
Compress prompts and message chains to the context size (
|
|
|
<a href="https://openrouter.ai/docs/transforms">OpenRouter Transforms</a>)
|
|
|
</Checkbox>
|
|
|
@@ -422,13 +423,10 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
<div style={{ display: "flex", flexDirection: "column", gap: 5 }}>
|
|
|
<VSCodeRadioGroup
|
|
|
value={apiConfiguration?.awsUseProfile ? "profile" : "credentials"}
|
|
|
- onChange={(e) => {
|
|
|
- const value = (e.target as HTMLInputElement)?.value
|
|
|
- const useProfile = value === "profile"
|
|
|
- handleInputChange("awsUseProfile")({
|
|
|
- target: { value: useProfile },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange(
|
|
|
+ "awsUseProfile",
|
|
|
+ (e) => (e.target as HTMLInputElement).value === "profile",
|
|
|
+ )}>
|
|
|
<VSCodeRadio value="credentials">AWS Credentials</VSCodeRadio>
|
|
|
<VSCodeRadio value="profile">AWS Profile</VSCodeRadio>
|
|
|
</VSCodeRadioGroup>
|
|
|
@@ -479,11 +477,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
value={apiConfiguration?.awsRegion || ""}
|
|
|
style={{ width: "100%" }}
|
|
|
onChange={(value: unknown) => {
|
|
|
- handleInputChange("awsRegion")({
|
|
|
- target: {
|
|
|
- value: (value as DropdownOption).value,
|
|
|
- },
|
|
|
- })
|
|
|
+ handleInputChange("awsRegion", dropdownEventTransform)
|
|
|
}}
|
|
|
options={[
|
|
|
{ value: "", label: "Select a region..." },
|
|
|
@@ -507,11 +501,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
</div>
|
|
|
<Checkbox
|
|
|
checked={apiConfiguration?.awsUseCrossRegionInference || false}
|
|
|
- onChange={(checked: boolean) => {
|
|
|
- handleInputChange("awsUseCrossRegionInference")({
|
|
|
- target: { value: checked },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange("awsUseCrossRegionInference", noTransform)}>
|
|
|
Use cross-region inference
|
|
|
</Checkbox>
|
|
|
<p
|
|
|
@@ -544,13 +534,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
id="vertex-region-dropdown"
|
|
|
value={apiConfiguration?.vertexRegion || ""}
|
|
|
style={{ width: "100%" }}
|
|
|
- onChange={(value: unknown) => {
|
|
|
- handleInputChange("vertexRegion")({
|
|
|
- target: {
|
|
|
- value: (value as DropdownOption).value,
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("vertexRegion", dropdownEventTransform)}
|
|
|
options={[
|
|
|
{ value: "", label: "Select a region..." },
|
|
|
{ value: "us-east5", label: "us-east5" },
|
|
|
@@ -634,21 +618,13 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
<div style={{ display: "flex", alignItems: "center" }}>
|
|
|
<Checkbox
|
|
|
checked={apiConfiguration?.openAiStreamingEnabled ?? true}
|
|
|
- onChange={(checked: boolean) => {
|
|
|
- handleInputChange("openAiStreamingEnabled")({
|
|
|
- target: { value: checked },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange("openAiStreamingEnabled", noTransform)}>
|
|
|
Enable streaming
|
|
|
</Checkbox>
|
|
|
</div>
|
|
|
<Checkbox
|
|
|
checked={apiConfiguration?.openAiUseAzure ?? false}
|
|
|
- onChange={(checked: boolean) => {
|
|
|
- handleInputChange("openAiUseAzure")({
|
|
|
- target: { value: checked },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange("openAiUseAzure", noTransform)}>
|
|
|
Use Azure
|
|
|
</Checkbox>
|
|
|
<Checkbox
|
|
|
@@ -656,11 +632,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
onChange={(checked: boolean) => {
|
|
|
setAzureApiVersionSelected(checked)
|
|
|
if (!checked) {
|
|
|
- handleInputChange("azureApiVersion")({
|
|
|
- target: {
|
|
|
- value: "",
|
|
|
- },
|
|
|
- })
|
|
|
+ setApiConfigurationField("azureApiVersion", "")
|
|
|
}
|
|
|
}}>
|
|
|
Set Azure API version
|
|
|
@@ -686,9 +658,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
{
|
|
|
iconName: "refresh",
|
|
|
onClick: () =>
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: { value: openAiModelInfoSaneDefaults },
|
|
|
- }),
|
|
|
+ setApiConfigurationField("openAiCustomModelInfo", openAiModelInfoSaneDefaults),
|
|
|
},
|
|
|
]}>
|
|
|
<div
|
|
|
@@ -745,18 +715,14 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
})(),
|
|
|
}}
|
|
|
title="Maximum number of tokens the model can generate in a single response"
|
|
|
- onChange={(e: any) => {
|
|
|
- const value = parseInt(e.target.value)
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: {
|
|
|
- value: {
|
|
|
- ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
- openAiModelInfoSaneDefaults),
|
|
|
- maxTokens: isNaN(value) ? undefined : value,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("openAiCustomModelInfo", (e) => {
|
|
|
+ const value = parseInt((e.target as HTMLInputElement).value)
|
|
|
+ return {
|
|
|
+ ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
+ openAiModelInfoSaneDefaults),
|
|
|
+ maxTokens: isNaN(value) ? undefined : value,
|
|
|
+ }
|
|
|
+ })}
|
|
|
placeholder="e.g. 4096">
|
|
|
<span style={{ fontWeight: 500 }}>Max Output Tokens</span>
|
|
|
</VSCodeTextField>
|
|
|
@@ -796,23 +762,17 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
})(),
|
|
|
}}
|
|
|
title="Total number of tokens (input + output) the model can process in a single request"
|
|
|
- onChange={(e: any) => {
|
|
|
- const parsed = parseInt(e.target.value)
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: {
|
|
|
- value: {
|
|
|
- ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
- openAiModelInfoSaneDefaults),
|
|
|
- contextWindow:
|
|
|
- e.target.value === ""
|
|
|
- ? undefined
|
|
|
- : isNaN(parsed)
|
|
|
- ? openAiModelInfoSaneDefaults.contextWindow
|
|
|
- : parsed,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("openAiCustomModelInfo", (e) => {
|
|
|
+ const value = (e.target as HTMLInputElement).value
|
|
|
+ const parsed = parseInt(value)
|
|
|
+ return {
|
|
|
+ ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
+ openAiModelInfoSaneDefaults),
|
|
|
+ contextWindow: isNaN(parsed)
|
|
|
+ ? openAiModelInfoSaneDefaults.contextWindow
|
|
|
+ : parsed,
|
|
|
+ }
|
|
|
+ })}
|
|
|
placeholder="e.g. 128000">
|
|
|
<span style={{ fontWeight: 500 }}>Context Window Size</span>
|
|
|
</VSCodeTextField>
|
|
|
@@ -861,17 +821,16 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
apiConfiguration?.openAiCustomModelInfo?.supportsImages ??
|
|
|
openAiModelInfoSaneDefaults.supportsImages
|
|
|
}
|
|
|
- onChange={(checked: boolean) => {
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: {
|
|
|
- value: {
|
|
|
- ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
- openAiModelInfoSaneDefaults),
|
|
|
- supportsImages: checked,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange(
|
|
|
+ "openAiCustomModelInfo",
|
|
|
+ (checked) => {
|
|
|
+ return {
|
|
|
+ ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
+ openAiModelInfoSaneDefaults),
|
|
|
+ supportsImages: checked,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ )}>
|
|
|
<span style={{ fontWeight: 500 }}>Image Support</span>
|
|
|
</Checkbox>
|
|
|
<i
|
|
|
@@ -909,17 +868,16 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
apiConfiguration?.openAiCustomModelInfo
|
|
|
?.supportsComputerUse ?? false
|
|
|
}
|
|
|
- onChange={(checked: boolean) => {
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: {
|
|
|
- value: {
|
|
|
- ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
- openAiModelInfoSaneDefaults),
|
|
|
- supportsComputerUse: checked,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange(
|
|
|
+ "openAiCustomModelInfo",
|
|
|
+ (checked) => {
|
|
|
+ return {
|
|
|
+ ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
+ openAiModelInfoSaneDefaults),
|
|
|
+ supportsComputerUse: checked,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ )}>
|
|
|
<span style={{ fontWeight: 500 }}>Computer Use</span>
|
|
|
</Checkbox>
|
|
|
<i
|
|
|
@@ -1004,23 +962,17 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
: "var(--vscode-errorForeground)"
|
|
|
})(),
|
|
|
}}
|
|
|
- onChange={(e: any) => {
|
|
|
- const parsed = parseFloat(e.target.value)
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: {
|
|
|
- value: {
|
|
|
- ...(apiConfiguration?.openAiCustomModelInfo ??
|
|
|
- openAiModelInfoSaneDefaults),
|
|
|
- inputPrice:
|
|
|
- e.target.value === ""
|
|
|
- ? undefined
|
|
|
- : isNaN(parsed)
|
|
|
- ? openAiModelInfoSaneDefaults.inputPrice
|
|
|
- : parsed,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("openAiCustomModelInfo", (e) => {
|
|
|
+ const value = (e.target as HTMLInputElement).value
|
|
|
+ const parsed = parseInt(value)
|
|
|
+ return {
|
|
|
+ ...(apiConfiguration?.openAiCustomModelInfo ??
|
|
|
+ openAiModelInfoSaneDefaults),
|
|
|
+ inputPrice: isNaN(parsed)
|
|
|
+ ? openAiModelInfoSaneDefaults.inputPrice
|
|
|
+ : parsed,
|
|
|
+ }
|
|
|
+ })}
|
|
|
placeholder="e.g. 0.0001">
|
|
|
<div style={{ display: "flex", alignItems: "center", gap: "4px" }}>
|
|
|
<span style={{ fontWeight: 500 }}>Input Price</span>
|
|
|
@@ -1055,23 +1007,17 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
: "var(--vscode-errorForeground)"
|
|
|
})(),
|
|
|
}}
|
|
|
- onChange={(e: any) => {
|
|
|
- const parsed = parseFloat(e.target.value)
|
|
|
- handleInputChange("openAiCustomModelInfo")({
|
|
|
- target: {
|
|
|
- value: {
|
|
|
- ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
- openAiModelInfoSaneDefaults),
|
|
|
- outputPrice:
|
|
|
- e.target.value === ""
|
|
|
- ? undefined
|
|
|
- : isNaN(parsed)
|
|
|
- ? openAiModelInfoSaneDefaults.outputPrice
|
|
|
- : parsed,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("openAiCustomModelInfo", (e) => {
|
|
|
+ const value = (e.target as HTMLInputElement).value
|
|
|
+ const parsed = parseInt(value)
|
|
|
+ return {
|
|
|
+ ...(apiConfiguration?.openAiCustomModelInfo ||
|
|
|
+ openAiModelInfoSaneDefaults),
|
|
|
+ outputPrice: isNaN(parsed)
|
|
|
+ ? openAiModelInfoSaneDefaults.outputPrice
|
|
|
+ : parsed,
|
|
|
+ }
|
|
|
+ })}
|
|
|
placeholder="e.g. 0.0002">
|
|
|
<div style={{ display: "flex", alignItems: "center", gap: "4px" }}>
|
|
|
<span style={{ fontWeight: 500 }}>Output Price</span>
|
|
|
@@ -1137,15 +1083,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
? apiConfiguration?.lmStudioModelId
|
|
|
: ""
|
|
|
}
|
|
|
- onChange={(e) => {
|
|
|
- const value = (e.target as HTMLInputElement)?.value
|
|
|
- // need to check value first since radio group returns empty string sometimes
|
|
|
- if (value) {
|
|
|
- handleInputChange("lmStudioModelId")({
|
|
|
- target: { value },
|
|
|
- })
|
|
|
- }
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange("lmStudioModelId")}>
|
|
|
{lmStudioModels.map((model) => (
|
|
|
<VSCodeRadio
|
|
|
key={model}
|
|
|
@@ -1224,18 +1162,11 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
? `${apiConfiguration.vsCodeLmModelSelector.vendor ?? ""}/${apiConfiguration.vsCodeLmModelSelector.family ?? ""}`
|
|
|
: ""
|
|
|
}
|
|
|
- onChange={(value: unknown) => {
|
|
|
- const valueStr = (value as DropdownOption)?.value
|
|
|
- if (!valueStr) {
|
|
|
- return
|
|
|
- }
|
|
|
+ onChange={handleInputChange("vsCodeLmModelSelector", (e) => {
|
|
|
+ const valueStr = (e as DropdownOption)?.value
|
|
|
const [vendor, family] = valueStr.split("/")
|
|
|
- handleInputChange("vsCodeLmModelSelector")({
|
|
|
- target: {
|
|
|
- value: { vendor, family },
|
|
|
- },
|
|
|
- })
|
|
|
- }}
|
|
|
+ return { vendor, family }
|
|
|
+ })}
|
|
|
style={{ width: "100%" }}
|
|
|
options={[
|
|
|
{ value: "", label: "Select a model..." },
|
|
|
@@ -1296,15 +1227,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
? apiConfiguration?.ollamaModelId
|
|
|
: ""
|
|
|
}
|
|
|
- onChange={(e) => {
|
|
|
- const value = (e.target as HTMLInputElement)?.value
|
|
|
- // need to check value first since radio group returns empty string sometimes
|
|
|
- if (value) {
|
|
|
- handleInputChange("ollamaModelId")({
|
|
|
- target: { value },
|
|
|
- })
|
|
|
- }
|
|
|
- }}>
|
|
|
+ onChange={handleInputChange("ollamaModelId")}>
|
|
|
{ollamaModels.map((model) => (
|
|
|
<VSCodeRadio
|
|
|
key={model}
|
|
|
@@ -1416,11 +1339,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
|
|
|
<div style={{ marginTop: "10px" }}>
|
|
|
<TemperatureControl
|
|
|
value={apiConfiguration?.modelTemperature}
|
|
|
- onChange={(value) => {
|
|
|
- handleInputChange("modelTemperature")({
|
|
|
- target: { value },
|
|
|
- })
|
|
|
- }}
|
|
|
+ onChange={handleInputChange("modelTemperature", noTransform)}
|
|
|
maxValue={2}
|
|
|
/>
|
|
|
</div>
|