|
@@ -103,6 +103,8 @@ const ApiOptions = ({
|
|
|
const [anthropicBaseUrlSelected, setAnthropicBaseUrlSelected] = useState(!!apiConfiguration?.anthropicBaseUrl)
|
|
const [anthropicBaseUrlSelected, setAnthropicBaseUrlSelected] = useState(!!apiConfiguration?.anthropicBaseUrl)
|
|
|
const [azureApiVersionSelected, setAzureApiVersionSelected] = useState(!!apiConfiguration?.azureApiVersion)
|
|
const [azureApiVersionSelected, setAzureApiVersionSelected] = useState(!!apiConfiguration?.azureApiVersion)
|
|
|
const [openRouterBaseUrlSelected, setOpenRouterBaseUrlSelected] = useState(!!apiConfiguration?.openRouterBaseUrl)
|
|
const [openRouterBaseUrlSelected, setOpenRouterBaseUrlSelected] = useState(!!apiConfiguration?.openRouterBaseUrl)
|
|
|
|
|
+ const [openAiHostHeaderSelected, setOpenAiHostHeaderSelected] = useState(!!apiConfiguration?.openAiHostHeader)
|
|
|
|
|
+ const [openAiLegacyFormatSelected, setOpenAiLegacyFormatSelected] = useState(!!apiConfiguration?.openAiLegacyFormat)
|
|
|
const [googleGeminiBaseUrlSelected, setGoogleGeminiBaseUrlSelected] = useState(
|
|
const [googleGeminiBaseUrlSelected, setGoogleGeminiBaseUrlSelected] = useState(
|
|
|
!!apiConfiguration?.googleGeminiBaseUrl,
|
|
!!apiConfiguration?.googleGeminiBaseUrl,
|
|
|
)
|
|
)
|
|
@@ -145,7 +147,11 @@ const ApiOptions = ({
|
|
|
} else if (selectedProvider === "openai") {
|
|
} else if (selectedProvider === "openai") {
|
|
|
vscode.postMessage({
|
|
vscode.postMessage({
|
|
|
type: "refreshOpenAiModels",
|
|
type: "refreshOpenAiModels",
|
|
|
- values: { baseUrl: apiConfiguration?.openAiBaseUrl, apiKey: apiConfiguration?.openAiApiKey },
|
|
|
|
|
|
|
+ values: {
|
|
|
|
|
+ baseUrl: apiConfiguration?.openAiBaseUrl,
|
|
|
|
|
+ apiKey: apiConfiguration?.openAiApiKey,
|
|
|
|
|
+ hostHeader: apiConfiguration?.openAiHostHeader,
|
|
|
|
|
+ },
|
|
|
})
|
|
})
|
|
|
} else if (selectedProvider === "ollama") {
|
|
} else if (selectedProvider === "ollama") {
|
|
|
vscode.postMessage({ type: "requestOllamaModels", text: apiConfiguration?.ollamaBaseUrl })
|
|
vscode.postMessage({ type: "requestOllamaModels", text: apiConfiguration?.ollamaBaseUrl })
|
|
@@ -779,6 +785,16 @@ const ApiOptions = ({
|
|
|
onChange={handleInputChange("openAiR1FormatEnabled", noTransform)}
|
|
onChange={handleInputChange("openAiR1FormatEnabled", noTransform)}
|
|
|
openAiR1FormatEnabled={apiConfiguration?.openAiR1FormatEnabled ?? false}
|
|
openAiR1FormatEnabled={apiConfiguration?.openAiR1FormatEnabled ?? false}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <Checkbox
|
|
|
|
|
+ checked={openAiLegacyFormatSelected}
|
|
|
|
|
+ onChange={(checked: boolean) => {
|
|
|
|
|
+ setOpenAiLegacyFormatSelected(checked)
|
|
|
|
|
+ setApiConfigurationField("openAiLegacyFormat", checked)
|
|
|
|
|
+ }}>
|
|
|
|
|
+ {t("settings:providers.useLegacyFormat")}
|
|
|
|
|
+ </Checkbox>
|
|
|
|
|
+ </div>
|
|
|
<Checkbox
|
|
<Checkbox
|
|
|
checked={apiConfiguration?.openAiStreamingEnabled ?? true}
|
|
checked={apiConfiguration?.openAiStreamingEnabled ?? true}
|
|
|
onChange={handleInputChange("openAiStreamingEnabled", noTransform)}>
|
|
onChange={handleInputChange("openAiStreamingEnabled", noTransform)}>
|
|
@@ -811,6 +827,28 @@ const ApiOptions = ({
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <Checkbox
|
|
|
|
|
+ checked={openAiHostHeaderSelected}
|
|
|
|
|
+ onChange={(checked: boolean) => {
|
|
|
|
|
+ setOpenAiHostHeaderSelected(checked)
|
|
|
|
|
+
|
|
|
|
|
+ if (!checked) {
|
|
|
|
|
+ setApiConfigurationField("openAiHostHeader", "")
|
|
|
|
|
+ }
|
|
|
|
|
+ }}>
|
|
|
|
|
+ {t("settings:providers.useHostHeader")}
|
|
|
|
|
+ </Checkbox>
|
|
|
|
|
+ {openAiHostHeaderSelected && (
|
|
|
|
|
+ <VSCodeTextField
|
|
|
|
|
+ value={apiConfiguration?.openAiHostHeader || ""}
|
|
|
|
|
+ onInput={handleInputChange("openAiHostHeader")}
|
|
|
|
|
+ placeholder="custom-api-hostname.example.com"
|
|
|
|
|
+ className="w-full mt-1"
|
|
|
|
|
+ />
|
|
|
|
|
+ )}
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<div className="flex flex-col gap-3">
|
|
<div className="flex flex-col gap-3">
|
|
|
<div className="text-sm text-vscode-descriptionForeground">
|
|
<div className="text-sm text-vscode-descriptionForeground">
|
|
|
{t("settings:providers.customModel.capabilities")}
|
|
{t("settings:providers.customModel.capabilities")}
|