continue proxy
This commit is contained in:
parent
58f252a3a3
commit
cc8bfaadb2
7 changed files with 28 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export class ControlPlaneClient {
|
|||
);
|
||||
}
|
||||
|
||||
private async getAccessToken(): Promise<string | undefined> {
|
||||
async getAccessToken(): Promise<string | undefined> {
|
||||
return (await this.sessionInfoPromise)?.accessToken;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<LLMOptions> = {
|
||||
apiBase: "http://localhost:3000/proxy/v1",
|
||||
apiBase:
|
||||
"https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/model-proxy/v1",
|
||||
};
|
||||
|
||||
supportsFim(): boolean {
|
||||
|
|
|
|||
1
extensions/vscode/package-lock.json
generated
1
extensions/vscode/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
1
gui/package-lock.json
generated
1
gui/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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`,
|
||||
);
|
||||
}
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue