|
|
@@ -243,10 +243,55 @@ const ApiOptions = ({
|
|
|
[selectedProvider],
|
|
|
)
|
|
|
|
|
|
+ // Base URL for provider documentation
|
|
|
+ const DOC_BASE_URL = "https://docs.roocode.com/providers"
|
|
|
+
|
|
|
+ // Custom URL path mappings for providers with different slugs
|
|
|
+ const providerUrlSlugs: Record<string, string> = {
|
|
|
+ "openai-native": "openai",
|
|
|
+ openai: "openai-compatible",
|
|
|
+ }
|
|
|
+
|
|
|
+ // Helper function to get provider display name from PROVIDERS constant
|
|
|
+ const getProviderDisplayName = (providerKey: string): string | undefined => {
|
|
|
+ const provider = PROVIDERS.find((p) => p.value === providerKey)
|
|
|
+ return provider?.label
|
|
|
+ }
|
|
|
+
|
|
|
+ // Helper function to get the documentation URL and name for the currently selected provider
|
|
|
+ const getSelectedProviderDocUrl = (): { url: string; name: string } | undefined => {
|
|
|
+ const displayName = getProviderDisplayName(selectedProvider)
|
|
|
+ if (!displayName) {
|
|
|
+ return undefined
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get the URL slug - use custom mapping if available, otherwise use the provider key
|
|
|
+ const urlSlug = providerUrlSlugs[selectedProvider] || selectedProvider
|
|
|
+
|
|
|
+ return {
|
|
|
+ url: `${DOC_BASE_URL}/${urlSlug}`,
|
|
|
+ name: displayName,
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<div className="flex flex-col gap-3">
|
|
|
- <div>
|
|
|
- <label className="block font-medium mb-1">{t("settings:providers.apiProvider")}</label>
|
|
|
+ <div className="flex flex-col gap-1 relative">
|
|
|
+ <div className="flex justify-between items-center">
|
|
|
+ <label className="block font-medium mb-1">{t("settings:providers.apiProvider")}</label>
|
|
|
+ {getSelectedProviderDocUrl() && (
|
|
|
+ <div className="text-xs text-vscode-descriptionForeground">
|
|
|
+ <VSCodeLink
|
|
|
+ href={getSelectedProviderDocUrl()!.url}
|
|
|
+ className="hover:text-vscode-foreground"
|
|
|
+ target="_blank">
|
|
|
+ {t("settings:providers.providerDocumentation", {
|
|
|
+ provider: getSelectedProviderDocUrl()!.name,
|
|
|
+ })}
|
|
|
+ </VSCodeLink>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
<Select
|
|
|
value={selectedProvider}
|
|
|
onValueChange={(value) => setApiConfigurationField("apiProvider", value as ApiProvider)}>
|
|
|
@@ -256,7 +301,7 @@ const ApiOptions = ({
|
|
|
<SelectContent>
|
|
|
<SelectItem value="openrouter">OpenRouter</SelectItem>
|
|
|
<SelectSeparator />
|
|
|
- {PROVIDERS.map(({ value, label }) => (
|
|
|
+ {PROVIDERS.filter((p) => p.value !== "openrouter").map(({ value, label }) => (
|
|
|
<SelectItem key={value} value={value}>
|
|
|
{label}
|
|
|
</SelectItem>
|