diff --git a/core/config/profile/ControlPlaneProfileLoader.ts b/core/config/profile/ControlPlaneProfileLoader.ts index fd36457ad..60db3841e 100644 --- a/core/config/profile/ControlPlaneProfileLoader.ts +++ b/core/config/profile/ControlPlaneProfileLoader.ts @@ -7,6 +7,7 @@ import { } from "../.."; import { ControlPlaneClient } from "../../control-plane/client"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics"; +import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { Telemetry } from "../../util/posthog"; import { defaultContextProvidersJetBrains, @@ -56,12 +57,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { )) as any); // First construct a SerializedContinueConfig from the ControlPlaneSettings (TODO) - const serializedConfig: SerializedContinueConfig = { - models: settings.models, - tabAutocompleteModel: settings.tabAutocompleteModel, - embeddingsProvider: settings.embeddingsModel, - reranker: settings.reranker, - }; + const serializedConfig: SerializedContinueConfig = settings; serializedConfig.contextProviders ??= ideInfo.ideType === "vscode" @@ -94,6 +90,13 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { ideInfo.extensionVersion, ); + finalConfig.models.forEach(async (model) => { + if (model.providerName === "continue-proxy") { + const accessToken = await this.controlPlaneClient.getAccessToken(); + (model as ContinueProxy).workOsAccessToken = accessToken; + } + }); + return finalConfig; } diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 63ced1ebc..f254d13d0 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -40,7 +40,7 @@ export class ControlPlaneClient { ); } - private async getAccessToken(): Promise { + async getAccessToken(): Promise { return (await this.sessionInfoPromise)?.accessToken; } diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index f23ea35cc..7c085bf75 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -2,9 +2,22 @@ import type { LLMOptions, ModelProvider } from "../../.."; import OpenAI from "../OpenAI.js"; class ContinueProxy extends OpenAI { + private _workOsAccessToken: string | undefined = undefined; + + get workOsAccessToken(): string | undefined { + return this._workOsAccessToken; + } + + set workOsAccessToken(value: string | undefined) { + if (this._workOsAccessToken !== value) { + this._workOsAccessToken = value; + this.apiKey = value; + } + } static providerName: ModelProvider = "continue-proxy"; static defaultOptions: Partial = { - apiBase: "http://localhost:3000/proxy/v1", + apiBase: + "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/model-proxy/v1", }; supportsFim(): boolean { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index cab0cad7d..658636fe7 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -97,6 +97,7 @@ "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.574.0", "@aws-sdk/credential-providers": "^3.596.0", + "@continuedev/config-types": "^1.0.6", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@types/jsdom": "^21.1.6", diff --git a/gui/package-lock.json b/gui/package-lock.json index 4b5330ad2..7de482640 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -89,6 +89,7 @@ "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.574.0", "@aws-sdk/credential-providers": "^3.596.0", + "@continuedev/config-types": "^1.0.6", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", "@types/jsdom": "^21.1.6", diff --git a/gui/src/components/ProfileSwitcher.tsx b/gui/src/components/ProfileSwitcher.tsx index fbb2e4838..9cd03f5c0 100644 --- a/gui/src/components/ProfileSwitcher.tsx +++ b/gui/src/components/ProfileSwitcher.tsx @@ -224,7 +224,7 @@ function ProfileSwitcher(props: {}) { } else { ideMessenger.post( "openUrl", - `http://app.continue.dev/workspaces/${selectedProfileId}/settings`, + `http://app.continue.dev/workspaces/${selectedProfileId}/config`, ); } }} diff --git a/packages/config-types/package.json b/packages/config-types/package.json index 81a21c861..091f18cd0 100644 --- a/packages/config-types/package.json +++ b/packages/config-types/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-types", - "version": "1.0.6", + "version": "1.0.7", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts",