Merge pull request #616 from websentry-ai/vs/support-unbound

Supports unbound API provider
This commit is contained in:
Matt Rubens
2025-01-29 00:10:21 -05:00
committed by GitHub
6 changed files with 426 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ import {
openRouterDefaultModelInfo,
vertexDefaultModelId,
vertexModels,
unboundDefaultModelId,
unboundModels,
} from "../../../../src/shared/api"
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
import { useExtensionState } from "../../context/ExtensionStateContext"
@@ -147,6 +149,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
{ value: "mistral", label: "Mistral" },
{ value: "lmstudio", label: "LM Studio" },
{ value: "ollama", label: "Ollama" },
{ value: "unbound", label: "Unbound" },
]}
/>
</div>
@@ -1283,6 +1286,35 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
</div>
)}
{selectedProvider === "unbound" && (
<div>
<VSCodeTextField
value={apiConfiguration?.unboundApiKey || ""}
style={{ width: "100%" }}
type="password"
onChange={handleInputChange("unboundApiKey")}
placeholder="Enter API Key...">
<span style={{ fontWeight: 500 }}>Unbound API Key</span>
</VSCodeTextField>
{!apiConfiguration?.unboundApiKey && (
<VSCodeButtonLink
href="https://gateway.getunbound.ai"
style={{ margin: "5px 0 0 0" }}
appearance="secondary">
Get Unbound API Key
</VSCodeButtonLink>
)}
<p
style={{
fontSize: "12px",
marginTop: 3,
color: "var(--vscode-descriptionForeground)",
}}>
This key is stored locally and only used to make API requests from this extension.
</p>
</div>
)}
{apiErrorMessage && (
<p
style={{
@@ -1315,6 +1347,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
{selectedProvider === "openai-native" && createDropdown(openAiNativeModels)}
{selectedProvider === "deepseek" && createDropdown(deepSeekModels)}
{selectedProvider === "mistral" && createDropdown(mistralModels)}
{selectedProvider === "unbound" && createDropdown(unboundModels)}
</div>
<ModelInfoView
@@ -1552,6 +1585,8 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) {
supportsImages: false, // VSCode LM API currently doesn't support images
},
}
case "unbound":
return getProviderData(unboundModels, unboundDefaultModelId)
default:
return getProviderData(anthropicModels, anthropicDefaultModelId)
}