Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/activate/handleUri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export const handleUri = async (uri: vscode.Uri) => {
}
case "/requesty": {
const code = query.get("code")
const baseUrl = query.get("baseUrl")
if (code) {
await visibleProvider.handleRequestyCallback(code)
await visibleProvider.handleRequestyCallback(code, baseUrl)
}
break
}
Expand Down
16 changes: 13 additions & 3 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import type { ClineMessage } from "@roo-code/types"
import { readApiMessages, saveApiMessages, saveTaskMessages } from "../task-persistence"
import { getNonce } from "./getNonce"
import { getUri } from "./getUri"
import { REQUESTY_BASE_URL } from "../../shared/utils/requesty"

/**
* https://github.com/microsoft/vscode-webview-ui-toolkit-samples/blob/main/default/weather-webview/src/providers/WeatherViewProvider.ts
Expand Down Expand Up @@ -1456,8 +1457,8 @@ export class ClineProvider

// Requesty

async handleRequestyCallback(code: string) {
let { apiConfiguration, currentApiConfigName = "default" } = await this.getState()
async handleRequestyCallback(code: string, baseUrl: string | null) {
let { apiConfiguration } = await this.getState()

const newConfiguration: ProviderSettings = {
...apiConfiguration,
Expand All @@ -1466,7 +1467,16 @@ export class ClineProvider
requestyModelId: apiConfiguration?.requestyModelId || requestyDefaultModelId,
}

await this.upsertProviderProfile(currentApiConfigName, newConfiguration)
// set baseUrl as undefined if we don't provide one
// or if it is the default requesty url
if (!baseUrl || baseUrl === REQUESTY_BASE_URL) {
newConfiguration.requestyBaseUrl = undefined
} else {
newConfiguration.requestyBaseUrl = baseUrl
}

const profileName = `Requesty (${new Date().toLocaleString()})`
await this.upsertProviderProfile(profileName, newConfiguration)
}

// Task history
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/requesty.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const REQUESTY_BASE_URL = "https://router.requesty.ai/v1"
export const REQUESTY_BASE_URL = "https://router.requesty.ai/v1"

type URLType = "router" | "app" | "api"

Expand Down
28 changes: 13 additions & 15 deletions webview-ui/src/components/settings/providers/Requesty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,19 @@ export const Requesty = ({
<div className="text-sm text-vscode-descriptionForeground -mt-2">
{t("settings:providers.apiKeyStorageNotice")}
</div>
{!apiConfiguration?.requestyApiKey && (
<a
href={getApiKeyUrl()}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-9 rounded-md px-3 w-full"
style={{
width: "100%",
textDecoration: "none",
color: "var(--vscode-button-foreground)",
backgroundColor: "var(--vscode-button-background)",
}}>
{t("settings:providers.getRequestyApiKey")}
</a>
)}
<a
href={getApiKeyUrl()}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-9 rounded-md px-3 w-full"
style={{
width: "100%",
textDecoration: "none",
color: "var(--vscode-button-foreground)",
backgroundColor: "var(--vscode-button-background)",
}}>
{t("settings:providers.getRequestyApiKey")}
</a>

<VSCodeCheckbox
checked={requestyEndpointSelected}
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
"success": "Models list refreshed successfully!",
"error": "Failed to refresh models list. Please try again."
},
"getRequestyApiKey": "Get Requesty API Key",
"getRequestyApiKey": "Create new Requesty API Key",
"getRequestyBaseUrl": "Base URL",
"requestyUseCustomBaseUrl": "Use custom base URL",
"openRouterTransformsText": "Compress prompts and message chains to the context size (<a>OpenRouter Transforms</a>)",
Expand Down