updates for on-prem-proxy

This commit is contained in:
Nate 2025-02-23 20:04:31 -08:00
parent ed2830a4d5
commit 1e39df3632
14 changed files with 42 additions and 17 deletions

View file

@ -48,7 +48,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.28",
"@continuedev/config-yaml": "^1.0.49",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -107,7 +107,7 @@
"wink-nlp-utils": "^2.1.0",
"workerpool": "^9.1.3",
"yaml": "^2.4.2",
"zod": "^3.23.8"
"zod": "^3.24.2"
},
"devDependencies": {
"@babel/preset-env": "^7.24.7",
@ -128,7 +128,7 @@
"@types/uuid": "^9.0.7",
"@types/win-ca": "^3.5.4",
"cross-env": "^7.0.3",
"esbuild": "0.24.0",
"esbuild": "0.17.19",
"eslint": "^8",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",

4
core/index.d.ts vendored
View file

@ -484,6 +484,8 @@ export interface LLMOptions {
apiBase?: string;
orgScopeId?: string | null;
onPremProxyUrl?: string | null;
aiGatewaySlug?: string;
cacheBehavior?: CacheBehavior;
capabilities?: ModelCapability;
@ -930,6 +932,8 @@ export interface ModelDescription {
apiBase?: string;
orgScopeId?: string | null;
onPremProxyUrl?: string | null;
contextLength?: number;
maxStopWords?: number;
template?: TemplateType;

View file

@ -124,6 +124,8 @@ export abstract class BaseLLM implements ILLM {
apiBase?: string;
orgScopeId?: string | null;
onPremProxyUrl?: string | null;
cacheBehavior?: CacheBehavior;
capabilities?: ModelCapability;
roles?: ModelRole[];
@ -208,6 +210,8 @@ export abstract class BaseLLM implements ILLM {
this.orgScopeId = options.orgScopeId;
this.apiBase = options.apiBase;
this.onPremProxyUrl = options.onPremProxyUrl;
this.aiGatewaySlug = options.aiGatewaySlug;
this.cacheBehavior = options.cacheBehavior;

View file

@ -9,7 +9,12 @@ import type { Chunk, LLMOptions } from "../../../index.js";
class ContinueProxy extends OpenAI {
set controlPlaneProxyInfo(value: ControlPlaneProxyInfo) {
this.apiKey = value.workOsAccessToken;
this.apiBase = new URL("openai/v1/", value.controlPlaneProxyUrl).toString();
if (!this.onPremProxyUrl) {
this.apiBase = new URL(
"openai/v1/",
value.controlPlaneProxyUrl,
).toString();
}
}
// The apiKey and apiBase are set to the values for the proxy,
@ -22,6 +27,10 @@ class ContinueProxy extends OpenAI {
this.actualApiBase = options.apiBase;
this.apiKeyLocation = options.apiKeyLocation;
this.orgScopeId = options.orgScopeId;
this.onPremProxyUrl = options.onPremProxyUrl;
if (this.onPremProxyUrl) {
this.apiBase = new URL("openai/v1/", this.onPremProxyUrl).toString();
}
}
static providerName = "continue-proxy";

View file

@ -13,7 +13,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.48",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -3038,9 +3038,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.48",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.48.tgz",
"integrity": "sha512-bcKGNaFicTRQ3hgHX6puFs6tig6aAfWWfboRL+z+o0rxxWKnlLrRi2YbVCqiyPdzre5rxMu+0Ielal1hERYSjA==",
"version": "1.0.50",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.50.tgz",
"integrity": "sha512-WRoMOPhHUjJ/y5GjsL8dkVvzAKRbb4zjfOvmUutHxGUu9lQkuAOnRATnOnLiowTY/xgImPTifOuyc79WyJRFzw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.48",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -106,7 +106,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.48",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

10
gui/package-lock.json generated
View file

@ -7,7 +7,7 @@
"name": "gui",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.0.48",
"@continuedev/config-yaml": "^1.0.50",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
@ -107,7 +107,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.48",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -543,9 +543,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.48",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.48.tgz",
"integrity": "sha512-bcKGNaFicTRQ3hgHX6puFs6tig6aAfWWfboRL+z+o0rxxWKnlLrRi2YbVCqiyPdzre5rxMu+0Ielal1hERYSjA==",
"version": "1.0.50",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.50.tgz",
"integrity": "sha512-WRoMOPhHUjJ/y5GjsL8dkVvzAKRbb4zjfOvmUutHxGUu9lQkuAOnRATnOnLiowTY/xgImPTifOuyc79WyJRFzw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "^1.0.48",
"@continuedev/config-yaml": "^1.0.50",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.49",
"version": "1.0.50",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -23,6 +23,7 @@ export async function renderSecrets(
unrolledConfigContent: string,
clientSecretStore: SecretStore,
orgScopeId: string | null, // The "scope" that the user is logged in with
onPremProxyUrl: string | null,
platformClient?: PlatformClient,
): Promise<AssistantUnrolled> {
// 1. First we need to get a list of all the FQSNs that are required to render the config
@ -73,6 +74,7 @@ export async function renderSecrets(
parsedYaml,
packageSlug,
orgScopeId,
onPremProxyUrl,
);
return finalConfig;
}
@ -113,6 +115,7 @@ export function useProxyForUnrenderedSecrets(
config: AssistantUnrolled,
packageSlug: PackageSlug,
orgScopeId: string | null,
onPremProxyUrl: string | null,
): AssistantUnrolled {
if (config.models) {
for (let i = 0; i < config.models.length; i++) {
@ -130,6 +133,7 @@ export function useProxyForUnrenderedSecrets(
),
apiKeyLocation: encodeSecretLocation(apiKeyLocation),
orgScopeId,
onPremProxyUrl,
apiKey: undefined,
};
}

View file

@ -176,6 +176,7 @@ export interface RenderSecretsUnrollAssistantOptions {
orgScopeId: string | null;
currentUserSlug: string;
platformClient: PlatformClient;
onPremProxyUrl: string | null;
}
export type UnrollAssistantOptions =
@ -255,6 +256,7 @@ export async function unrollAssistantFromContent(
parseAssistantUnrolled(renderedYaml),
assistantSlug,
options.orgScopeId,
options.onPremProxyUrl,
);
return finalConfig;
}

View file

@ -66,6 +66,7 @@ export const modelSchema = z.union([
provider: z.literal("continue-proxy"),
apiKeyLocation: z.string(),
orgScopeId: z.string().nullable(),
onPremProxyUrl: z.string().nullable(),
}),
z.object({
...baseModelFields,

View file

@ -107,6 +107,7 @@ describe("E2E Scenarios", () => {
platformClient,
orgScopeId: "test-org",
currentUserSlug: "test-user",
onPremProxyUrl: null,
},
);