diff --git a/binary/package-lock.json b/binary/package-lock.json index 367b0eb93..6cbfcf0ad 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -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", diff --git a/core/index.d.ts b/core/index.d.ts index 0b38062a5..ceb6e796b 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -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; diff --git a/core/llm/index.ts b/core/llm/index.ts index 5b90c7bb8..ccbad6699 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -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; diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 62138b1ce..00ec93dbc 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -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"; diff --git a/core/package-lock.json b/core/package-lock.json index ceabdbd0b..16ea0d64d 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -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", diff --git a/core/package.json b/core/package.json index 279df90ac..48d1f987c 100644 --- a/core/package.json +++ b/core/package.json @@ -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", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 9e3fd8458..570040b11 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -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", diff --git a/gui/package-lock.json b/gui/package-lock.json index 65a3432d8..23ff4cd6a 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -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", diff --git a/gui/package.json b/gui/package.json index da2f597c0..51c2ec9e6 100644 --- a/gui/package.json +++ b/gui/package.json @@ -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", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 9c8618935..75d11129a 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -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", diff --git a/packages/config-yaml/src/load/clientRender.ts b/packages/config-yaml/src/load/clientRender.ts index b58385e25..585fc24ee 100644 --- a/packages/config-yaml/src/load/clientRender.ts +++ b/packages/config-yaml/src/load/clientRender.ts @@ -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 { // 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, }; } diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 3f5dfa37e..40bdcb2c8 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -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; } diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index b2cad388a..fd84f6bef 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -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, diff --git a/packages/config-yaml/test/index.test.ts b/packages/config-yaml/test/index.test.ts index 25f43f13b..16a531fac 100644 --- a/packages/config-yaml/test/index.test.ts +++ b/packages/config-yaml/test/index.test.ts @@ -107,6 +107,7 @@ describe("E2E Scenarios", () => { platformClient, orgScopeId: "test-org", currentUserSlug: "test-user", + onPremProxyUrl: null, }, );