diff --git a/.eslintrc.shared.json b/.eslintrc.shared.json index f62954280..db8cb1271 100644 --- a/.eslintrc.shared.json +++ b/.eslintrc.shared.json @@ -7,6 +7,7 @@ "plugins": ["@typescript-eslint", "import"], "rules": { "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-floating-promises": "warn", "@typescript-eslint/semi": "warn", "curly": "warn", "eqeqeq": "warn", diff --git a/.github/workflows/auto-assign-issue.yaml b/.github/workflows/auto-assign-issue.yaml index dc5388ef3..940f7cf54 100644 --- a/.github/workflows/auto-assign-issue.yaml +++ b/.github/workflows/auto-assign-issue.yaml @@ -16,9 +16,9 @@ jobs: repo-token: ${{ secrets.CI_GITHUB_TOKEN }} assignees: sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa numOfAssignee: 1 - - name: "Add default labels" - uses: actions-ecosystem/action-add-labels@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - labels: | - "needs-triage" + # - name: "Add default labels" + # uses: actions-ecosystem/action-add-labels@v1 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # labels: | + # "needs-triage" diff --git a/core/.eslintrc.json b/core/.eslintrc.json index fa760cc0c..08948b866 100644 --- a/core/.eslintrc.json +++ b/core/.eslintrc.json @@ -7,7 +7,8 @@ "rules": { "quotes": ["off", "double", {}], "@typescript-eslint/naming-convention": "off", - "@typescript-eslint/no-floating-promises": "off", + // This is important: when floating promises cause unhandled rejections, the JetBrains binary blows up + "@typescript-eslint/no-floating-promises": "error", "import/order": "off", "curly": "off", "@typescript-eslint/semi": "off", diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 2d3fe9eba..fd9cf2923 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -261,7 +261,9 @@ export class CompletionProvider { // Save to cache if (!outcome.cacheHit && helper.options.useCache) { - (await this.autocompleteCache).put(outcome.prefix, outcome.completion); + (await this.autocompleteCache) + .put(outcome.prefix, outcome.completion) + .catch((e) => console.warn(`Failed to save to cache: ${e.message}`)); } // When using the JetBrains extension, Mark as displayed diff --git a/core/autocomplete/context/ImportDefinitionsService.ts b/core/autocomplete/context/ImportDefinitionsService.ts index e2288138a..0115b443f 100644 --- a/core/autocomplete/context/ImportDefinitionsService.ts +++ b/core/autocomplete/context/ImportDefinitionsService.ts @@ -22,7 +22,13 @@ export class ImportDefinitionsService { constructor(private readonly ide: IDE) { ide.onDidChangeActiveTextEditor((filepath) => { - this.cache.initKey(filepath); + this.cache + .initKey(filepath) + .catch((e) => + console.warn( + `Failed to initialize ImportDefinitionService: ${e.message}`, + ), + ); }); } diff --git a/core/autocomplete/generation/ListenableGenerator.ts b/core/autocomplete/generation/ListenableGenerator.ts index e6b36019b..3fddb55a3 100644 --- a/core/autocomplete/generation/ListenableGenerator.ts +++ b/core/autocomplete/generation/ListenableGenerator.ts @@ -3,16 +3,18 @@ export class ListenableGenerator { private _buffer: T[] = []; private _listeners: Set<(value: T) => void> = new Set(); private _isEnded = false; - private _abortController: AbortController + private _abortController: AbortController; constructor( source: AsyncGenerator, private readonly onError: (e: any) => void, - abortController: AbortController + abortController: AbortController, ) { this._source = source; this._abortController = abortController; - this._start(); + this._start().catch((e) => + console.log(`Listenable generator failed: ${e.message}`), + ); } public cancel() { diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index c830ef10e..0c3167b7b 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -349,7 +349,7 @@ export class ConfigHandler { this.currentOrg = org; if (profileId) { - this.setSelectedProfileId(profileId); + await this.setSelectedProfileId(profileId); } else { this.currentProfile = org.currentProfile; await this.reloadConfig(); diff --git a/core/config/yaml/convertFromJson.ts b/core/config/yaml/convertFromJson.ts deleted file mode 100644 index dbc567005..000000000 --- a/core/config/yaml/convertFromJson.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { AssistantUnrolled, ModelConfig } from "@continuedev/config-yaml"; - -import { SerializedContinueConfig } from "../.."; - -/* -TODO this is not functional -*/ -export function convertConfigJsonToConfigYaml( - configJson: SerializedContinueConfig, -): AssistantUnrolled { - return { - name: "Local Assistant", - version: "1.0.0", - schema: "v1", - models: [ - ...configJson.models.map( - (model): ModelConfig => ({ - model: model.model, - name: model.title, - // defaultCompletionOptions: model.completionOptions, - provider: model.provider, - roles: ["chat", "edit", "apply", "summarize"], - }), - ), - // TODO - // tabAutocompleteModels - // embeddingsModels - // rerankModels - ], - context: configJson.contextProviders?.map((provider) => ({ - provider: provider.name, - params: provider.params, - })), - }; -} diff --git a/core/core.ts b/core/core.ts index 21208970d..e5c9eeab0 100644 --- a/core/core.ts +++ b/core/core.ts @@ -349,8 +349,8 @@ export class Core { return await this.configHandler.getSerializedConfig(); }); - on("config/ideSettingsUpdate", (msg) => { - this.configHandler.updateIdeSettings(msg.data); + on("config/ideSettingsUpdate", async (msg) => { + await this.configHandler.updateIdeSettings(msg.data); }); on("config/refreshProfiles", async (msg) => { @@ -389,7 +389,7 @@ export class Core { }); on("mcp/reloadServer", async (msg) => { - MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); + await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); }); // Context providers on("context/addDocs", async (msg) => { @@ -743,7 +743,7 @@ export class Core { if (!config) { return false; } - + const llm = config?.selectedModelByRole.chat; if (!llm) { throw new Error("No chat model selected"); @@ -1034,10 +1034,9 @@ export class Core { } this.indexingCancellationController = new AbortController(); try { - for await (const update of (await this.codebaseIndexerPromise).refreshDirs( - paths, - this.indexingCancellationController.signal, - )) { + for await (const update of ( + await this.codebaseIndexerPromise + ).refreshDirs(paths, this.indexingCancellationController.signal)) { let updateToSend = { ...update }; void this.messenger.request("indexProgress", updateToSend); @@ -1067,10 +1066,10 @@ export class Core { return; } this.indexingCancellationController = new AbortController(); - try{ - for await (const update of (await this.codebaseIndexerPromise).refreshFiles( - files, - )) { + try { + for await (const update of ( + await this.codebaseIndexerPromise + ).refreshFiles(files)) { let updateToSend = { ...update }; void this.messenger.request("indexProgress", updateToSend); @@ -1093,18 +1092,18 @@ export class Core { // private handleIndexingError(e: any) { - if (e instanceof LLMError) { - // Need to report this specific error to the IDE for special handling - this.messenger.request("reportError", e); - } - // broadcast indexing error - let updateToSend: IndexingProgressUpdate = { - progress: 0, - status: "failed", - desc: e.message, - }; - void this.messenger.request("indexProgress", updateToSend); - this.codebaseIndexingState = updateToSend; - void this.sendIndexingErrorTelemetry(updateToSend); + if (e instanceof LLMError) { + // Need to report this specific error to the IDE for special handling + void this.messenger.request("reportError", e); + } + // broadcast indexing error + let updateToSend: IndexingProgressUpdate = { + progress: 0, + status: "failed", + desc: e.message, + }; + void this.messenger.request("indexProgress", updateToSend); + this.codebaseIndexingState = updateToSend; + void this.sendIndexingErrorTelemetry(updateToSend); } } diff --git a/core/edit/streamDiffLines.ts b/core/edit/streamDiffLines.ts index f88aeefc0..320962b7c 100644 --- a/core/edit/streamDiffLines.ts +++ b/core/edit/streamDiffLines.ts @@ -161,9 +161,11 @@ export async function* streamDiffLines({ ? llm.streamComplete(prompt, new AbortController().signal, { raw: true, prediction, + reasoning: false, }) : llm.streamChat(prompt, new AbortController().signal, { prediction, + reasoning: false, }); let lines = streamLines(completion); diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index bf733b5ce..9a2da5008 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -57,7 +57,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { FOREIGN KEY (snippetId) REFERENCES code_snippets (id) )`); - migrate("add_signature_column", async () => { + await migrate("add_signature_column", async () => { const tableInfo = await db.all("PRAGMA table_info(code_snippets)"); const signatureColumnExists = tableInfo.some( (column) => column.name === "signature", @@ -71,7 +71,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { } }); - migrate("delete_duplicate_code_snippets", async () => { + await migrate("delete_duplicate_code_snippets", async () => { // Delete duplicate entries in code_snippets await db.exec(` DELETE FROM code_snippets @@ -256,7 +256,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { progress: i / results.compute.length, status: "indexing", }; - markComplete([compute], IndexResultType.Compute); + await markComplete([compute], IndexResultType.Compute); } // Delete @@ -278,7 +278,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { ); } - markComplete([del], IndexResultType.Delete); + await markComplete([del], IndexResultType.Delete); } // Add tag @@ -313,7 +313,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { ); } - markComplete([results.addTag[i]], IndexResultType.AddTag); + await markComplete([results.addTag[i]], IndexResultType.AddTag); } // Remove tag @@ -343,7 +343,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { ); } - markComplete([results.removeTag[i]], IndexResultType.RemoveTag); + await markComplete([results.removeTag[i]], IndexResultType.RemoveTag); } } diff --git a/core/indexing/TestCodebaseIndex.ts b/core/indexing/TestCodebaseIndex.ts index e36dff7ce..86b22ab98 100644 --- a/core/indexing/TestCodebaseIndex.ts +++ b/core/indexing/TestCodebaseIndex.ts @@ -48,10 +48,10 @@ export class TestCodebaseIndex implements CodebaseIndex { ); } - markComplete(results.compute, IndexResultType.Compute); - markComplete(results.addTag, IndexResultType.AddTag); - markComplete(results.del, IndexResultType.Delete); - markComplete(results.removeTag, IndexResultType.RemoveTag); + await markComplete(results.compute, IndexResultType.Compute); + await markComplete(results.addTag, IndexResultType.AddTag); + await markComplete(results.del, IndexResultType.Delete); + await markComplete(results.removeTag, IndexResultType.RemoveTag); } async getIndexedFilesForTags(tags: IndexTag[]): Promise { diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index cc9eef842..d82c34b20 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -510,7 +510,7 @@ export default class DocsService { } catch (e) { if (e instanceof LLMError) { // Report the error to the IDE - this.messenger?.request("reportError", e); + await this.messenger?.request("reportError", e); } this.handleStatusUpdate({ ...fixedStatus, diff --git a/core/llm/asyncEncoder.test.ts b/core/llm/asyncEncoder.test.ts index 9ed5eb80a..0b02b3d5a 100644 --- a/core/llm/asyncEncoder.test.ts +++ b/core/llm/asyncEncoder.test.ts @@ -1,4 +1,4 @@ -import { LlamaAsyncEncoder, GPTAsyncEncoder } from "./asyncEncoder"; +import { GPTAsyncEncoder, LlamaAsyncEncoder } from "./asyncEncoder"; describe("llama encoder", () => { var tokenizer: LlamaAsyncEncoder; @@ -8,7 +8,7 @@ describe("llama encoder", () => { }); afterAll(() => { - tokenizer.close(); + tokenizer.close().catch((e) => {}); }); test("hello world", async () => { @@ -30,7 +30,7 @@ describe("tiktoken encoder", () => { }); afterAll(() => { - tokenizer.close(); + tokenizer.close().catch((e) => {}); }); test("hello world", async () => { diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 145cb1ac6..1393ac44e 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -72,6 +72,7 @@ const PROVIDER_SUPPORTS_IMAGES: string[] = [ "sagemaker", "continue-proxy", "openrouter", + "venice", "sambanova", "vertexai", "azure", @@ -96,7 +97,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "pixtral", "llama3.2", "llama-3.2", - "llama4" + "llama4", ]; function modelSupportsTools(modelDescription: ModelDescription) { diff --git a/core/llm/llms/Docker.ts b/core/llm/llms/Docker.ts index 131f45b14..3860a9b9e 100644 --- a/core/llm/llms/Docker.ts +++ b/core/llm/llms/Docker.ts @@ -60,7 +60,7 @@ class Docker extends OpenAI implements ModelInstaller { } // Check if Docker Model Runner is active and enable it if needed - this.ensureModelRunnerEnabled(); + this.ensureModelRunnerEnabled().catch((e) => {}); } /** @@ -198,7 +198,7 @@ class Docker extends OpenAI implements ModelInstaller { return { success: true, stdout, stderr }; } catch (error) { console.error(`Failed to install Docker model ${targetModel}:`, error); -// Fix: Type check the error before accessing message property + // Fix: Type check the error before accessing message property const errorMessage = error instanceof Error ? error.message : String(error); throw new Error( diff --git a/core/llm/llms/HuggingFaceTGI.ts b/core/llm/llms/HuggingFaceTGI.ts index 481532f95..c9812cca3 100644 --- a/core/llm/llms/HuggingFaceTGI.ts +++ b/core/llm/llms/HuggingFaceTGI.ts @@ -14,18 +14,22 @@ class HuggingFaceTGI extends BaseLLM { this.fetch(new URL("info", this.apiBase), { method: "GET", - }).then(async (response) => { - if (response.status !== 200) { - console.warn( - "Error calling Hugging Face TGI /info endpoint: ", - await response.text(), - ); - return; - } - const json = await response.json(); - this.model = json.model_id; - this.contextLength = Number.parseInt(json.max_input_length); - }); + }) + .then(async (response) => { + if (response.status !== 200) { + console.warn( + "Error calling Hugging Face TGI /info endpoint: ", + await response.text(), + ); + return; + } + const json = await response.json(); + this.model = json.model_id; + this.contextLength = Number.parseInt(json.max_input_length); + }) + .catch((e) => { + console.log(`Failed to list models for HuggingFace TGI: ${e.message}`); + }); } private _convertArgs(options: CompletionOptions, prompt: string) { diff --git a/core/llm/llms/Venice.ts b/core/llm/llms/Venice.ts new file mode 100644 index 000000000..fd4c0ebfe --- /dev/null +++ b/core/llm/llms/Venice.ts @@ -0,0 +1,22 @@ +import { ChatCompletionCreateParams } from "@continuedev/openai-adapters"; +import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js"; + +import OpenAI from "./OpenAI"; + +class Venice extends OpenAI { + static providerName = "venice"; + static defaultOptions: Partial = { + apiBase: "https://api.venice.ai/api/v1", + }; + + protected _convertArgs(options: CompletionOptions, messages: ChatMessage[]): ChatCompletionCreateParams { + const finalOptions = super._convertArgs(options, messages) as ChatCompletionCreateParams & { venice_parameters?: any }; + if ("venice_parameters" in options && typeof options.venice_parameters === "object") { + finalOptions.venice_parameters = { ...options.venice_parameters }; + } + return finalOptions; + } + +} + +export default Venice; \ No newline at end of file diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 84f471c6f..cc1b70b19 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -22,7 +22,11 @@ class VertexAI extends BaseLLM { private clientPromise = new GoogleAuth({ scopes: "https://www.googleapis.com/auth/cloud-platform", - }).getClient(); + }) + .getClient() + .catch((e) => { + console.warn(`Failed to load credentials for Vertex AI: ${e.message}`); + }); private static getDefaultApiBaseFrom(options: LLMOptions) { const { region, projectId } = options; @@ -60,8 +64,8 @@ class VertexAI extends BaseLLM { async fetch(url: RequestInfo | URL, init?: RequestInit) { const client = await this.clientPromise; - const { token } = await client.getAccessToken(); - if (!token) { + const result = await client?.getAccessToken(); + if (!result?.token) { throw new Error( "Could not get an access token. Set up your Google Application Default Credentials.", ); @@ -70,7 +74,7 @@ class VertexAI extends BaseLLM { ...init, headers: { "Content-Type": "application/json", - Authorization: `Bearer ${token}`, + Authorization: `Bearer ${result.token}`, ...init?.headers, }, }); @@ -370,8 +374,8 @@ class VertexAI extends BaseLLM { protected async _embed(chunks: string[]): Promise { const client = await this.clientPromise; - const { token } = await client.getAccessToken(); - if (!token) { + const result = await client?.getAccessToken(); + if (!result?.token) { throw new Error( "Could not get an access token. Set up your Google Application Default Credentials.", ); @@ -386,7 +390,7 @@ class VertexAI extends BaseLLM { }), headers: { "Content-Type": "application/json", - Authorization: `Bearer ${token}`, + Authorization: `Bearer ${result.token}`, }, }, ); @@ -402,8 +406,4 @@ class VertexAI extends BaseLLM { } } -async function delay(seconds: number) { - return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); -} - export default VertexAI; diff --git a/core/llm/llms/Vllm.ts b/core/llm/llms/Vllm.ts index 7273a67f6..b237b4c7e 100644 --- a/core/llm/llms/Vllm.ts +++ b/core/llm/llms/Vllm.ts @@ -16,19 +16,23 @@ class Vllm extends OpenAI { this.fetch(this._getEndpoint("models"), { method: "GET", headers: this._getHeaders(), - }).then(async (response) => { - if (response.status !== 200) { - console.warn( - "Error calling vLLM /models endpoint: ", - await response.text(), - ); - return; - } - const json = await response.json(); - const data = json.data[0]; - this.model = data.id; - this.contextLength = Number.parseInt(data.max_model_len); - }); + }) + .then(async (response) => { + if (response.status !== 200) { + console.warn( + "Error calling vLLM /models endpoint: ", + await response.text(), + ); + return; + } + const json = await response.json(); + const data = json.data[0]; + this.model = data.id; + this.contextLength = Number.parseInt(data.max_model_len); + }) + .catch((e) => { + console.log(`Failed to list models for vLLM: ${e.message}`); + }); } } diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index d04f02dfe..26fbe2cb2 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -57,6 +57,7 @@ import ContinueProxy from "./stubs/ContinueProxy"; import TestLLM from "./Test"; import TextGenWebUI from "./TextGenWebUI"; import Together from "./Together"; +import Venice from "./Venice"; import VertexAI from "./VertexAI"; import Vllm from "./Vllm"; import Voyage from "./Voyage"; @@ -109,6 +110,7 @@ export const LLMClasses = [ Cerebras, Asksage, Nebius, + Venice, VertexAI, xAI, SiliconFlow, diff --git a/docs/docs/customize/model-providers/more/venice.md b/docs/docs/customize/model-providers/more/venice.md new file mode 100644 index 000000000..b612189ae --- /dev/null +++ b/docs/docs/customize/model-providers/more/venice.md @@ -0,0 +1,35 @@ +# Venice + +Venice.AI is a privacy focused generative AI platform, allowing users to interact with open-source LLMs without storing any private user data. To get started with Venice's API, either purchase a pro account, stake $VVV to obtain daily inference allotments or fund your account with USD and head over to https://venice.ai/settings/api. Venice hosts state of the art open-source AI models and supports the OpenAI API standard, allowing users to easily interact with the platform. Learn more about the Venice API at https://venice.ai/api. + +Change `~/.continue/config.json` to look like the following. + +```json title="config.json" +{ + "models": [ + { + "provider": "venice", + "title": "Autodetect", + "model": "AUTODETECT", + "apiKey": "..." + } + ] +} +``` + +To utilize features offered by the venice API that are not apart of the standard OpenAI API schema, include these as `venice_parameters` + +For example, to use models with no system prompt, you can explicitly turn off the feature like so: + +```json title="config.json" +{ + "completionOptions": { + "venice_parameters": { + "include_venice_system_prompt" : false + }, + ... + } +} +``` + +Learn more about available settings [here](https://docs.venice.ai/api-reference/api-spec). \ No newline at end of file diff --git a/extensions/vscode/.eslintrc.json b/extensions/vscode/.eslintrc.json index f4973fa87..e1e339ce7 100644 --- a/extensions/vscode/.eslintrc.json +++ b/extensions/vscode/.eslintrc.json @@ -5,6 +5,7 @@ }, "extends": ["../../.eslintrc.shared.json"], "rules": { - "@typescript-eslint/naming-convention": "off" + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-floating-promises": "warn" } } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 64b65c525..583dbb60e 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -231,8 +231,9 @@ "function-network", "scaleway", "relace", + "morph", "ovhcloud", - "morph" + "venice" ], "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)", @@ -280,8 +281,9 @@ "### Function Network offers private, affordable user-owned AI\nTo get started with Function Network, obtain your API key from [Function Network](https://www.function.network/join-waitlist). Function Network provides a variety of models for chat, completion, and embeddings.", "### Scaleway\n Generative APIs are serverless endpoints for the most popular AI models.\nHosted in European data centers and priced competitively per million tokens used, models served by Scaleway are ideal for users requiring low latency, full data privacy, and 100% compliance with EU AI Act. To get access to the Scaleway Generative APIs, read the [Quickstart guide](https://www.scaleway.com/en/docs/ai-data/generative-apis/quickstart/) and get a [valid API key](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/).", "### Relace\n Relace provides a fast apply model. To get started, obtain an API key from [here](https://app.relace.ai/settings/api-keys).", + "### Morph\nMorph provides a fast apply model. To get started, obtain an API key from [here](https://morphllm.com/dashboard).", "### OVHcloud AI Endpoints is a serverless inference API that provides access to a curated selection of models (e.g., Llama, Mistral, Qwen, Deepseek). It is designed with security and data privacy in mind and is compliant with GDPR. To get started, create an API key on the OVHcloud [AI Endpoints website](https://endpoints.ai.cloud.ovh.net/). For more information, including pricing, visit the OVHcloud [AI Endpoints product page](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/).", - "### Morph\nMorph provides a fast apply model. To get started, obtain an API key from [here](https://morphllm.com/dashboard)." + "### Venice\n Venice.AI is a privacy-focused generative AI platform, allowing users to interact with open-source LLMs without storing any private user data.\nHosted models support the OpenAI API standard, providing seamless integration for users seeking privacy and flexibility.\nTo get started with the Venice API, either purchase a pro account, stake $VVV for daily inference allotments, or fund your account with USD.\nVisit the [API settings page](https://venice.ai/settings/api) or learn more at the [Venice API documentation](https://venice.ai/api)." ], "type": "string" }, @@ -517,7 +519,8 @@ "xAI", "kindo", "scaleway", - "ovhcloud" + "ovhcloud", + "venice" ] } }, @@ -1764,6 +1767,30 @@ } } } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["venice"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": ["AUTODETECT"] + }, + { + "type": "string" + } + ] + } + } + } } ] }, diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 48690802a..e03500809 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -9,6 +9,7 @@ "version": "1.1.29", "license": "Apache-2.0", "dependencies": { + "@continuedev/config-types": "^1.0.14", "@continuedev/fetch": "^1.0.3", "@electron/rebuild": "^3.2.10", "@reduxjs/toolkit": "^1.9.3", @@ -693,9 +694,9 @@ } }, "node_modules/@continuedev/config-types": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.13.tgz", - "integrity": "sha512-5Qmy2x58uhW1GYknypFT/7iwxEJSbt8gMgfQReV7d6xjbJ09ISOTki3hIfCilKrTCo0gIY6pzKEfCoQkUTEi6Q==", + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.14.tgz", + "integrity": "sha512-PVHyHPyRXd2QsaNgnCpiKYU3uHFTlyuQSkqE8OwrBmQqO6/TXUVIr/2EGtyIZGrml4Y+rGMSH40WU4/0t4SGpQ==", "dependencies": { "zod": "^3.23.8" } diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 4464ec7fc..52715bdfd 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.29", + "version": "1.1.30", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -661,6 +661,7 @@ "vscode-extension-tester": "^8.10.0" }, "dependencies": { + "@continuedev/config-types": "^1.0.14", "@continuedev/fetch": "^1.0.3", "@electron/rebuild": "^3.2.10", "@reduxjs/toolkit": "^1.9.3", diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 83e067b10..9a78d6b8e 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import * as fs from "node:fs"; + import { ContextMenuConfig, ILLM, ModelInstaller } from "core"; import { CompletionProvider } from "core/autocomplete/CompletionProvider"; import { ConfigHandler } from "core/config/ConfigHandler"; @@ -9,10 +12,15 @@ import { walkDirAsync } from "core/indexing/walkDir"; import { isModelInstaller } from "core/llm"; import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo"; import { startLocalOllama } from "core/util/ollamaHelper"; -import { getDevDataFilePath } from "core/util/paths"; +import { + getConfigJsonPath, + getConfigYamlPath, + getDevDataFilePath, +} from "core/util/paths"; import { Telemetry } from "core/util/posthog"; import readLastLines from "read-last-lines"; import * as vscode from "vscode"; +import * as YAML from "yaml"; import { getAutocompleteStatusBarDescription, @@ -32,11 +40,13 @@ import { Battery } from "./util/battery"; import { getMetaKeyLabel } from "./util/util"; import { VsCodeIde } from "./VsCodeIde"; +import { convertJsonToYamlConfig } from "../../../packages/config-yaml/dist"; import { addCodeToContextFromRange, addEntireFileToContext, addHighlightedCodeToContext, } from "./util/addCode"; +import { openEditorAndRevealRange } from "./util/vscode"; let fullScreenPanel: vscode.WebviewPanel | undefined; @@ -754,6 +764,35 @@ const getCommandsMap: ( ); } }, + "continue.convertConfigJsonToConfigYaml": async () => { + const configJson = fs.readFileSync(getConfigJsonPath(), "utf-8"); + const parsed = JSON.parse(configJson); + const configYaml = convertJsonToYamlConfig(parsed); + + const configYamlPath = getConfigYamlPath(); + fs.writeFileSync(configYamlPath, YAML.stringify(configYaml)); + + // Open config.yaml + await openEditorAndRevealRange( + vscode.Uri.file(configYamlPath), + undefined, + undefined, + false, + ); + + vscode.window + .showInformationMessage( + "Your config.json has been converted to the new config.yaml format. If you need to switch back to config.json, you can delete or rename config.yaml.", + "Read the docs", + ) + .then((selection) => { + if (selection === "Read the docs") { + vscode.env.openExternal( + vscode.Uri.parse("https://docs.continue.dev/yaml-migration"), + ); + } + }); + }, }; }; diff --git a/extensions/vscode/src/lang-server/codeLens/providers/ConfigJsonConverterCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/ConfigJsonConverterCodeLensProvider.ts new file mode 100644 index 000000000..cb9bdfc6a --- /dev/null +++ b/extensions/vscode/src/lang-server/codeLens/providers/ConfigJsonConverterCodeLensProvider.ts @@ -0,0 +1,30 @@ +import { getConfigYamlPath } from "core/util/paths"; +import * as fs from "fs"; +import * as vscode from "vscode"; + +export class ConfigJsonConverterCodeLensProvider + implements vscode.CodeLensProvider +{ + public provideCodeLenses( + document: vscode.TextDocument, + _: vscode.CancellationToken, + ): vscode.CodeLens[] | Thenable { + if ( + !document.uri.fsPath.includes(".continue") || + !document.uri.fsPath.endsWith("config.json") + ) { + return []; + } + + if (fs.existsSync(getConfigYamlPath())) { + return []; + } + + return [ + new vscode.CodeLens(new vscode.Range(0, 0, 0, 0), { + title: "config.json is being deprecated. Convert to config.yaml", + command: "continue.convertConfigJsonToConfigYaml", + }), + ]; + } +} diff --git a/extensions/vscode/src/lang-server/codeLens/providers/index.ts b/extensions/vscode/src/lang-server/codeLens/providers/index.ts index 03d89aa44..fc120d002 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/index.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/index.ts @@ -2,3 +2,5 @@ export { DownloadYamlExtensionCodeLensProvider } from "./DownloadYamlExtensionCo export { QuickActionsCodeLensProvider } from "./QuickActionsCodeLensProvider"; export { SuggestionsCodeLensProvider } from "./SuggestionsCodeLensProvider"; export { VerticalDiffCodeLensProvider as VerticalPerLineCodeLensProvider } from "./VerticalPerLineCodeLensProvider"; + +export { ConfigJsonConverterCodeLensProvider } from "./ConfigJsonConverterCodeLensProvider"; diff --git a/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts b/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts index e17312fa0..0488aa61a 100644 --- a/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts +++ b/extensions/vscode/src/lang-server/codeLens/registerAllCodeLensProviders.ts @@ -19,6 +19,8 @@ let suggestionsCodeLensDisposable: vscode.Disposable | undefined = undefined; let configPyCodeLensDisposable: vscode.Disposable | undefined = undefined; let tutorialCodeLensDisposable: vscode.Disposable | undefined = undefined; let quickActionsCodeLensDisposable: vscode.Disposable | undefined = undefined; +let configJsonConverterCodeLensDisposable: vscode.Disposable | undefined = + undefined; let downloadYamlExtensionCodeLensDisposable: vscode.Disposable | undefined = undefined; @@ -98,6 +100,10 @@ export function registerAllCodeLensProviders( tutorialCodeLensDisposable.dispose(); } + if (configJsonConverterCodeLensDisposable) { + configJsonConverterCodeLensDisposable.dispose(); + } + if (downloadYamlExtensionCodeLensDisposable) { downloadYamlExtensionCodeLensDisposable.dispose(); } @@ -116,6 +122,11 @@ export function registerAllCodeLensProviders( new providers.SuggestionsCodeLensProvider(), ); + configJsonConverterCodeLensDisposable = registerCodeLensProvider( + "*", + new providers.ConfigJsonConverterCodeLensProvider(), + ); + downloadYamlExtensionCodeLensDisposable = registerCodeLensProvider( "yaml", new providers.DownloadYamlExtensionCodeLensProvider(), @@ -131,6 +142,7 @@ export function registerAllCodeLensProviders( context.subscriptions.push(verticalPerLineCodeLensProvider); context.subscriptions.push(suggestionsCodeLensDisposable); + context.subscriptions.push(configJsonConverterCodeLensDisposable); return { verticalDiffCodeLens }; } diff --git a/gui/.eslintrc.json b/gui/.eslintrc.json index c902e379f..462fd5592 100644 --- a/gui/.eslintrc.json +++ b/gui/.eslintrc.json @@ -12,7 +12,8 @@ // "plugin:react/recommended" ], "rules": { - "@typescript-eslint/naming-convention": "off" + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-floating-promises": "warn" }, "overrides": [ { diff --git a/gui/public/logos/venice.png b/gui/public/logos/venice.png new file mode 100644 index 000000000..be0d8eb5f Binary files /dev/null and b/gui/public/logos/venice.png differ diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 5f0dc75b4..f56a6b210 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -996,4 +996,24 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo ], apiKeyUrl: "https://cloud.siliconflow.cn/account/ak", }, + venice: { + title: "Venice", + provider: "venice", + icon: "venice.png", + description: "Venice.", + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API Key", + placeholder: "Enter your Venice API key", + required: true, + }, + ], + packages: [ + {...models.AUTODETECT} + ], + apiKeyUrl: "https://venice.ai/chat" + } }; diff --git a/packages/config-yaml/src/converter.ts b/packages/config-yaml/src/converter.ts index 84786c880..40e1f226a 100644 --- a/packages/config-yaml/src/converter.ts +++ b/packages/config-yaml/src/converter.ts @@ -46,11 +46,69 @@ function convertReranker(m: NonNullable): ModelYaml { }; } +function withFromContextProvider( + contextProvider: NonNullable[number], +): Record | undefined { + const { name, params } = contextProvider; + + switch (name) { + case "greptile": + return { + GITHUB_TOKEN: params?.GithubToken ?? "", + GREPTILE_TOKEN: params?.GreptileToken ?? "", + }; + case "jira": + return { + JIRA_TOKEN: params?.JiraToken ?? "", + JIRA_API_VERSION: params?.JiraEmail, + JIRA_DOMAIN: params?.JiraDomain ?? "", + }; + case "postgres": + return { + POSTGRES_HOST: params?.host, + POSTGRES_PORT: params?.port, + POSTGRES_USER: params?.user, + POSTGRES_PASSWORD: params?.password, + POSTGRES_DATABASE: params?.database, + POSTGRES_SCHEMA: params?.schema, + }; + case "gitlab-mr": + return { + GITLAB_TOKEN: params?.token, + DOMAIN: params?.domain, + }; + case "discord": + return { + DISCORD_KEY: params?.discordKey, + DISCORD_GUILD_ID: params?.guildId, + DISCORD_CHANNELS: params?.channels, + }; + case "commits": + return { + DEPTH: params?.Depth, + LAST_N_COMMITS_DEPTH: params?.LastXCommitsDepth, + }; + default: + return undefined; + } +} + function convertContext(configJson: ConfigJson): ContextYaml[] { const context: ContextYaml[] = configJson.contextProviders?.map((ctx) => { + // ctx providers that weren't given official blocks + if ( + ["web", "debugger", "issue", "database", "google", "http"].includes( + ctx.name, + ) + ) { + return { + provider: ctx.name, + params: ctx.params, + }; + } return { - uses: `builtin/${ctx.name}`, + uses: `continuedev/${ctx.name === "open" ? "open-files" : ctx.name}-context`, with: ctx.params, }; }) ?? [];