diff --git a/core/continueServer/interface.ts b/core/continueServer/interface.ts index 72d129733..0e55a77d0 100644 --- a/core/continueServer/interface.ts +++ b/core/continueServer/interface.ts @@ -19,6 +19,9 @@ export interface EmbeddingsCacheResponse { } export interface IContinueServerClient { + connected: boolean; + url: URL | undefined; + getUserToken(): Promise; getConfig(): Promise<{ configJson: string; configJs: string }>; getFromIndexCache( keys: string[], diff --git a/core/continueServer/stubs/client.ts b/core/continueServer/stubs/client.ts index 98d429e87..c3cd1a8b0 100644 --- a/core/continueServer/stubs/client.ts +++ b/core/continueServer/stubs/client.ts @@ -5,10 +5,28 @@ import { } from "../interface.js"; export class ContinueServerClient implements IContinueServerClient { + url: URL | undefined; + constructor( - private readonly serverUrl: string, + serverUrl: string | undefined, private readonly userToken: Promise, - ) {} + ) { + try { + this.url = + typeof serverUrl !== "string" || serverUrl === "" + ? undefined + : new URL(serverUrl); + } catch (e) { + console.warn("Invalid Continue server url", e); + this.url = undefined; + } + } + + getUserToken(): Promise { + return this.userToken; + } + + connected: boolean = false; public async getConfig(): Promise<{ configJson: string; configJs: string }> { throw new Error("Not Implemented"); diff --git a/core/index.d.ts b/core/index.d.ts index 1fed42566..5830ef8f9 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -520,6 +520,7 @@ type ModelProvider = | "deepinfra" | "flowise" | "groq" + | "continue-proxy" | "custom"; export type ModelName = diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 1b50b0536..9629a1910 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -1,6 +1,7 @@ // NOTE: vectordb requirement must be listed in extensions/vscode to avoid error import { v4 as uuidv4 } from "uuid"; import { Table } from "vectordb"; +import { IContinueServerClient } from "../continueServer/interface.js"; import { BranchAndDir, Chunk, @@ -8,7 +9,6 @@ import { IndexTag, IndexingProgressUpdate, } from "../index.js"; -import { ContinueServerClient } from "../continueServer/stubs/client.js"; import { MAX_CHUNK_SIZE } from "../llm/constants.js"; import { getBasename } from "../util/index.js"; import { getLanceDbPath } from "../util/paths.js"; @@ -40,7 +40,7 @@ export class LanceDbIndex implements CodebaseIndex { constructor( private readonly embeddingsProvider: EmbeddingsProvider, private readonly readFile: (filepath: string) => Promise, - private readonly continueServerClient?: ContinueServerClient, + private readonly continueServerClient: IContinueServerClient, ) {} private tableNameForTag(tag: IndexTag) { @@ -176,7 +176,7 @@ export class LanceDbIndex implements CodebaseIndex { }; // Check remote cache - if (this.continueServerClient !== undefined) { + if (this.continueServerClient.connected) { try { const keys = results.compute.map(({ cacheKey }) => cacheKey); const resp = await this.continueServerClient.getFromIndexCache( diff --git a/core/indexing/chunk/ChunkCodebaseIndex.ts b/core/indexing/chunk/ChunkCodebaseIndex.ts index 81b89f3cb..cb9522012 100644 --- a/core/indexing/chunk/ChunkCodebaseIndex.ts +++ b/core/indexing/chunk/ChunkCodebaseIndex.ts @@ -1,5 +1,5 @@ +import { IContinueServerClient } from "../../continueServer/interface.js"; import { Chunk, IndexTag, IndexingProgressUpdate } from "../../index.js"; -import { ContinueServerClient } from "../../continueServer/stubs/client.js"; import { MAX_CHUNK_SIZE } from "../../llm/constants.js"; import { getBasename } from "../../util/index.js"; import { DatabaseConnection, SqliteDb, tagToString } from "../refreshIndex.js"; @@ -17,7 +17,7 @@ export class ChunkCodebaseIndex implements CodebaseIndex { constructor( private readonly readFile: (filepath: string) => Promise, - private readonly continueServerClient?: ContinueServerClient, + private readonly continueServerClient: IContinueServerClient, ) { this.readFile = readFile; } @@ -71,7 +71,7 @@ export class ChunkCodebaseIndex implements CodebaseIndex { } // Check the remote cache - if (this.continueServerClient !== undefined) { + if (this.continueServerClient.connected) { try { const keys = results.compute.map(({ cacheKey }) => cacheKey); const resp = await this.continueServerClient.getFromIndexCache( diff --git a/core/indexing/indexCodebase.ts b/core/indexing/indexCodebase.ts index 0aef8c1f3..92b4fd5fa 100644 --- a/core/indexing/indexCodebase.ts +++ b/core/indexing/indexCodebase.ts @@ -1,6 +1,6 @@ -import { IDE, IndexTag, IndexingProgressUpdate } from "../index.js"; import { ConfigHandler } from "../config/handler.js"; -import { ContinueServerClient } from "../continueServer/stubs/client.js"; +import { IContinueServerClient } from "../continueServer/interface.js"; +import { IDE, IndexTag, IndexingProgressUpdate } from "../index.js"; import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex.js"; import { FullTextSearchCodebaseIndex } from "./FullTextSearch.js"; import { LanceDbIndex } from "./LanceDbIndex.js"; @@ -21,21 +21,12 @@ export class PauseToken { } export class CodebaseIndexer { - private continueServerClient?: ContinueServerClient; constructor( private readonly configHandler: ConfigHandler, private readonly ide: IDE, private readonly pauseToken: PauseToken, - private readonly continueServerUrl: string | undefined, - private readonly userToken: Promise, - ) { - if (continueServerUrl) { - this.continueServerClient = new ContinueServerClient( - continueServerUrl, - userToken, - ); - } - } + private readonly continueServerClient: IContinueServerClient, + ) {} private async getIndexesToBuild(): Promise { const config = await this.configHandler.loadConfig(); diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index a5be47e07..36333326a 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -41,6 +41,7 @@ const PROVIDER_HANDLES_TEMPLATING: ModelProvider[] = [ "together", "anthropic", "bedrock", + "continue-proxy", ]; const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [ @@ -50,6 +51,7 @@ const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [ "free-trial", "anthropic", "bedrock", + "continue-proxy", ]; const MODEL_SUPPORTS_IMAGES: string[] = [ diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 2029de667..845e1d9c9 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -27,6 +27,7 @@ import OpenAIFreeTrial from "./OpenAIFreeTrial.js"; import Replicate from "./Replicate.js"; import TextGenWebUI from "./TextGenWebUI.js"; import Together from "./Together.js"; +import ContinueProxy from "./stubs/ContinueProxy.js"; function convertToLetter(num: number): string { let result = ""; @@ -96,6 +97,7 @@ const LLMs = [ OpenAIFreeTrial, Flowise, Groq, + ContinueProxy, ]; export async function llmFromDescription( @@ -134,7 +136,7 @@ export async function llmFromDescription( }, systemMessage, writeLog, - uniqueId + uniqueId, }; return new cls(options); diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts new file mode 100644 index 000000000..018347326 --- /dev/null +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -0,0 +1,8 @@ +import { ModelProvider } from "../../.."; +import OpenAI from "../OpenAI"; + +class ContinueProxy extends OpenAI { + static providerName: ModelProvider = "continue-proxy"; +} + +export default ContinueProxy; diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 3cc4544c3..4475d6892 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -148,7 +148,8 @@ "mistral", "deepinfra", "flowise", - "groq" + "groq", + "continue-proxy" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -166,7 +167,8 @@ "### LMStudio\nLMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/lmstudio)", "### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/llamafile)", "### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)", - "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)" + "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)", + "### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models." ], "type": "string" }, diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 3cc4544c3..4475d6892 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -148,7 +148,8 @@ "mistral", "deepinfra", "flowise", - "groq" + "groq", + "continue-proxy" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -166,7 +167,8 @@ "### LMStudio\nLMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/lmstudio)", "### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/llamafile)", "### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)", - "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)" + "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)", + "### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models." ], "type": "string" }, diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 3cc4544c3..4475d6892 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -148,7 +148,8 @@ "mistral", "deepinfra", "flowise", - "groq" + "groq", + "continue-proxy" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -166,7 +167,8 @@ "### LMStudio\nLMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/lmstudio)", "### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/llamafile)", "### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)", - "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)" + "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)", + "### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models." ], "type": "string" }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 09b27fcc0..19e8b7637 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -148,7 +148,8 @@ "mistral", "deepinfra", "flowise", - "groq" + "groq", + "continue-proxy" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -166,7 +167,8 @@ "### LMStudio\nLMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/lmstudio)", "### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/llamafile)", "### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)", - "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)" + "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)", + "### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models." ], "type": "string" }, @@ -265,10 +267,7 @@ "apiType": { "title": "Api Type", "markdownDescription": "OpenAI API type, either `openai` or `azure`", - "enum": [ - "openai", - "azure" - ] + "enum": ["openai", "azure"] }, "apiVersion": { "title": "Api Version", @@ -281,11 +280,7 @@ "type": "string" } }, - "required": [ - "title", - "provider", - "model" - ], + "required": ["title", "provider", "model"], "allOf": [ { "if": { @@ -295,9 +290,7 @@ } }, "not": { - "required": [ - "provider" - ] + "required": ["provider"] } }, "then": { @@ -323,48 +316,33 @@ ] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { - "required": [ - "apiKey" - ] + "required": ["apiKey"] } }, { "if": { "properties": { "provider": { - "enum": [ - "huggingface-tgi", - "huggingface-inference-api" - ] + "enum": ["huggingface-tgi", "huggingface-inference-api"] } } }, "then": { - "required": [ - "apiBase" - ] + "required": ["apiBase"] }, - "required": [ - "provider" - ] + "required": ["provider"] }, { "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -384,14 +362,10 @@ "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -422,14 +396,10 @@ "if": { "properties": { "provider": { - "enum": [ - "replicate" - ] + "enum": ["replicate"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -459,14 +429,10 @@ "if": { "properties": { "provider": { - "enum": [ - "free-trial" - ] + "enum": ["free-trial"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -493,9 +459,7 @@ "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] }, "apiType": { "not": { @@ -503,9 +467,7 @@ } } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -563,14 +525,10 @@ "if": { "properties": { "provider": { - "enum": [ - "anthropic" - ] + "enum": ["anthropic"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -598,22 +556,15 @@ "if": { "properties": { "provider": { - "enum": [ - "cohere" - ] + "enum": ["cohere"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { "model": { - "enum": [ - "command-r", - "command-r-plus" - ] + "enum": ["command-r", "command-r-plus"] } } } @@ -622,14 +573,10 @@ "if": { "properties": { "provider": { - "enum": [ - "bedrock" - ] + "enum": ["bedrock"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -654,14 +601,10 @@ "if": { "properties": { "provider": { - "enum": [ - "gemini" - ] + "enum": ["gemini"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -679,14 +622,10 @@ "if": { "properties": { "provider": { - "enum": [ - "together" - ] + "enum": ["together"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -720,14 +659,10 @@ "if": { "properties": { "provider": { - "enum": [ - "deepinfra" - ] + "enum": ["deepinfra"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -750,9 +685,7 @@ ] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -798,14 +731,10 @@ "if": { "properties": { "provider": { - "enum": [ - "ollama" - ] + "enum": ["ollama"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -853,14 +782,10 @@ "if": { "properties": { "provider": { - "enum": [ - "mistral" - ] + "enum": ["mistral"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -881,14 +806,10 @@ "if": { "properties": { "provider": { - "enum": [ - "groq" - ] + "enum": ["groq"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -912,30 +833,20 @@ "const": "azure" } }, - "required": [ - "apiType" - ] + "required": ["apiType"] }, "then": { - "required": [ - "engine", - "apiVersion", - "apiBase" - ] + "required": ["engine", "apiVersion", "apiBase"] } }, { "if": { "properties": { "provider": { - "enum": [ - "openai" - ] + "enum": ["openai"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -952,9 +863,7 @@ "const": "llamafile" } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -968,14 +877,10 @@ "if": { "properties": { "provider": { - "enum": [ - "text-gen-webui" - ] + "enum": ["text-gen-webui"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -989,14 +894,10 @@ "if": { "properties": { "provider": { - "enum": [ - "flowise" - ] + "enum": ["flowise"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { "properties": { @@ -1023,10 +924,7 @@ "type": "string" } }, - "required": [ - "key", - "value" - ] + "required": ["key", "value"] } }, "additionalFlowiseConfiguration": { @@ -1045,10 +943,7 @@ "description": "Configuration Property value" } }, - "required": [ - "key", - "value" - ] + "required": ["key", "value"] } }, "model": { @@ -1137,9 +1032,7 @@ "type": "string" } }, - "required": [ - "default" - ] + "required": ["default"] }, "SlashCommand": { "title": "SlashCommand", @@ -1198,9 +1091,7 @@ "if": { "properties": { "name": { - "enum": [ - "issue" - ] + "enum": ["issue"] } } }, @@ -1213,23 +1104,17 @@ "description": "Enter the URL of the GitHub repository for which you want to generate the issue." } }, - "required": [ - "repositoryUrl" - ] + "required": ["repositoryUrl"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "edit" - ] + "enum": ["edit"] } } }, @@ -1254,9 +1139,7 @@ "if": { "properties": { "name": { - "enum": [ - "share" - ] + "enum": ["share"] } } }, @@ -1274,10 +1157,7 @@ } } ], - "required": [ - "name", - "description" - ] + "required": ["name", "description"] }, "CustomCommand": { "title": "CustomCommand", @@ -1296,11 +1176,7 @@ "type": "string" } }, - "required": [ - "name", - "prompt", - "description" - ] + "required": ["name", "prompt", "description"] }, "ContextProviderWithParams": { "title": "ContextProviderWithParams", @@ -1373,9 +1249,7 @@ "if": { "properties": { "name": { - "enum": [ - "google" - ] + "enum": ["google"] } } }, @@ -1388,23 +1262,17 @@ "description": "Your API key for https://serper.dev in order to get Google search results" } }, - "required": [ - "serperApiKey" - ] + "required": ["serperApiKey"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "open" - ] + "enum": ["open"] } } }, @@ -1426,9 +1294,7 @@ "if": { "properties": { "name": { - "enum": [ - "issue" - ] + "enum": ["issue"] } } }, @@ -1457,37 +1323,24 @@ "type": { "type": "string", "description": "The type of issues to search for", - "enum": [ - "open", - "closed", - "all" - ] + "enum": ["open", "closed", "all"] } }, - "required": [ - "owner", - "repo" - ] + "required": ["owner", "repo"] } } }, - "required": [ - "repos" - ] + "required": ["repos"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "database" - ] + "enum": ["database"] } } }, @@ -1505,11 +1358,7 @@ "connection_type": { "type": "string", "description": "The type of database (e.g., 'postgres', 'mysql')", - "enum": [ - "postgres", - "mysql", - "sqlite" - ] + "enum": ["postgres", "mysql", "sqlite"] }, "connection": { "type": "object", @@ -1542,25 +1391,17 @@ "required": [] } }, - "required": [ - "name", - "type", - "connection" - ] + "required": ["name", "type", "connection"] } }, - "required": [ - "connections" - ] + "required": ["connections"] } }, { "if": { "properties": { "name": { - "enum": [ - "gitlab-mr" - ] + "enum": ["gitlab-mr"] } } }, @@ -1581,23 +1422,17 @@ "description": "If you have code selected, filters out comments that aren't related to the selection." } }, - "required": [ - "token" - ] + "required": ["token"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "jira" - ] + "enum": ["jira"] } } }, @@ -1643,24 +1478,17 @@ ] } }, - "required": [ - "domain", - "token" - ] + "required": ["domain", "token"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "http" - ] + "enum": ["http"] } } }, @@ -1673,24 +1501,17 @@ "description": "The HTTP endpoint of your context provider server." } }, - "required": [ - "url" - ] + "required": ["url"] } }, - "required": [ - "params" - ] + "required": ["params"] } }, { "if": { "properties": { "name": { - "enum": [ - "codebase", - "folder" - ] + "enum": ["codebase", "folder"] } } }, @@ -1725,9 +1546,7 @@ "if": { "properties": { "name": { - "enum": [ - "postgres" - ] + "enum": ["postgres"] } } }, @@ -1779,19 +1598,11 @@ } } }, - "required": [ - "host", - "port", - "user", - "password", - "database" - ] + "required": ["host", "port", "user", "password", "database"] } } ], - "required": [ - "name" - ] + "required": ["name"] }, "SerializedContinueConfig": { "title": "config.json", @@ -1942,46 +1753,32 @@ "$ref": "#/definitions/RequestOptions" } }, - "required": [ - "provider" - ], + "required": ["provider"], "allOf": [ { "if": { "properties": { "provider": { - "enum": [ - "ollama" - ] + "enum": ["ollama"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { - "required": [ - "model" - ] + "required": ["model"] } }, { "if": { "properties": { "provider": { - "enum": [ - "cohere" - ] + "enum": ["cohere"] } }, - "required": [ - "provider" - ] + "required": ["provider"] }, "then": { - "required": [ - "apiKey" - ] + "required": ["apiKey"] } } ] @@ -1992,33 +1789,22 @@ "type": "object", "properties": { "name": { - "enum": [ - "cohere", - "voyage", - "llm", - "free-trial" - ] + "enum": ["cohere", "voyage", "llm", "free-trial"] }, "params": { "type": "object" } }, - "required": [ - "name" - ], + "required": ["name"], "allOf": [ { "if": { "properties": { "name": { - "enum": [ - "cohere" - ] + "enum": ["cohere"] } }, - "required": [ - "name" - ] + "required": ["name"] }, "then": { "properties": { @@ -2040,9 +1826,7 @@ "type": "string" } }, - "required": [ - "apiKey" - ] + "required": ["apiKey"] } } } @@ -2051,14 +1835,10 @@ "if": { "properties": { "name": { - "enum": [ - "llm" - ] + "enum": ["llm"] } }, - "required": [ - "name" - ] + "required": ["name"] }, "then": { "properties": { @@ -2069,9 +1849,7 @@ "type": "string" } }, - "required": [ - "modelTitle" - ] + "required": ["modelTitle"] } } } @@ -2080,14 +1858,10 @@ "if": { "properties": { "name": { - "enum": [ - "voyage" - ] + "enum": ["voyage"] } }, - "required": [ - "name" - ] + "required": ["name"] }, "then": { "properties": { @@ -2098,14 +1872,10 @@ "type": "string" }, "model": { - "enum": [ - "rerank-lite-1" - ] + "enum": ["rerank-lite-1"] } }, - "required": [ - "apiKey" - ] + "required": ["apiKey"] } } } @@ -2161,11 +1931,7 @@ "description": "An optional template string to be used for autocomplete. It will be rendered with the Mustache templating language, and is passed the 'prefix' and 'suffix' variables." }, "multilineCompletions": { - "enum": [ - "always", - "never", - "auto" - ], + "enum": ["always", "never", "auto"], "description": "If set to true, Continue will only complete a single line at a time." }, "useCache": { @@ -2194,10 +1960,7 @@ "type": "object", "properties": { "codeBlockToolbarPosition": { - "enum": [ - "top", - "bottom" - ], + "enum": ["top", "bottom"], "default": "top", "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." } @@ -2211,9 +1974,7 @@ "defaultContext": { "type": "array", "items": { - "enum": [ - "activeFile" - ] + "enum": ["activeFile"] } }, "modelRoles": { @@ -2253,10 +2014,7 @@ }, "mergeBehavior": { "type": "string", - "enum": [ - "merge", - "overwrite" - ], + "enum": ["merge", "overwrite"], "default": "merge", "title": "Merge behavior", "markdownDescription": "If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json." @@ -2264,4 +2022,4 @@ } } } -} \ No newline at end of file +} diff --git a/extensions/vscode/src/extension/vscodeExtension.ts b/extensions/vscode/src/extension/vscodeExtension.ts index a8756822e..4c9476fe0 100644 --- a/extensions/vscode/src/extension/vscodeExtension.ts +++ b/extensions/vscode/src/extension/vscodeExtension.ts @@ -1,4 +1,5 @@ import { ConfigHandler } from "core/config/handler"; +import { ContinueServerClient } from "core/continueServer/stubs/client"; import { CodebaseIndexer, PauseToken } from "core/indexing/indexCodebase"; import { IdeSettings } from "core/protocol"; import { getConfigJsonPath, getConfigTsPath } from "core/util/paths"; @@ -49,13 +50,32 @@ export class VsCodeExtension { userToken: settings.get("userToken", ""), }; + const userTokenPromise: Promise = new Promise( + async (resolve) => { + if ( + remoteConfigServerUrl === null || + remoteConfigServerUrl === undefined || + remoteConfigServerUrl.trim() === "" + ) { + resolve(undefined); + return; + } + const token = await getUserToken(); + resolve(token); + }, + ); + + const continueServerClient = new ContinueServerClient( + ideSettings.remoteConfigServerUrl, + userTokenPromise, + ); + // Config Handler with output channel const outputChannel = vscode.window.createOutputChannel( "Continue - LLM Prompt/Completion", ); this.configHandler = new ConfigHandler( this.ide, - Promise.resolve(ideSettings), async (log: string) => { outputChannel.appendLine( "==========================================================================", @@ -68,6 +88,7 @@ export class VsCodeExtension { (() => this.webviewProtocol?.request("configUpdate", undefined)).bind( this, ), + continueServerClient, ); this.configHandler.reloadConfig(); @@ -117,26 +138,11 @@ export class VsCodeExtension { this.diffManager.webviewProtocol = this.webviewProtocol; - const userTokenPromise: Promise = new Promise( - async (resolve) => { - if ( - remoteConfigServerUrl === null || - remoteConfigServerUrl === undefined || - remoteConfigServerUrl.trim() === "" - ) { - resolve(undefined); - return; - } - const token = await getUserToken(); - resolve(token); - }, - ); this.indexer = new CodebaseIndexer( this.configHandler, this.ide, indexingPauseToken, - ideSettings.remoteConfigServerUrl, - userTokenPromise, + continueServerClient, ); if (