diff --git a/.vscode/launch.json b/.vscode/launch.json index e32b84fe5e..1ff86900f6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -49,10 +49,13 @@ "args": [ // Pass a directory to manually test in "${workspaceFolder}/extensions/vscode", - "${workspaceFolder}/extensions/vscode/manual-testing-sandbox/example.ts", + "${workspaceFolder}/extensions/vscode/manual-testing-sandbox/test.js", "--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode" ], - "outFiles": ["${workspaceFolder}/extensions/vscode/out/**/*.js"], + "outFiles": [ + "${workspaceFolder}/extensions/vscode/out/**/*.js", + "/Users/natesesti/.continue/config.ts" + ], "preLaunchTask": "vscode-extension:build" }, // Has to be run after starting the server (separately or using the compound configuration) diff --git a/core/config/handler.ts b/core/config/handler.ts index f022015b98..25e7751f8f 100644 --- a/core/config/handler.ts +++ b/core/config/handler.ts @@ -1,4 +1,4 @@ -import { ContinueConfig, ContinueRcJson, IDE, ILLM } from "../index.js"; +import { ContinueConfig, ContinueRcJson, IDE, ILLM, IContextProvider } from "../index.js"; import { IdeSettings } from "../protocol.js"; import { Telemetry } from "../util/posthog.js"; import { @@ -10,6 +10,7 @@ import { export class ConfigHandler { private savedConfig: ContinueConfig | undefined; private savedBrowserConfig?: BrowserSerializedContinueConfig; + private additionalContextProviders: IContextProvider[] = []; constructor( private readonly ide: IDE, @@ -82,6 +83,10 @@ export class ConfigHandler { ideInfo.extensionVersion, ); + (this.savedConfig.contextProviders ?? []).push( + ...this.additionalContextProviders, + ); + return this.savedConfig; } @@ -95,4 +100,9 @@ export class ConfigHandler { return model; } + + registerCustomContextProvider(contextProvider: IContextProvider) { + this.additionalContextProviders.push(contextProvider); + this.reloadConfig(); + } } diff --git a/core/index.d.ts b/core/index.d.ts index 0fd18496a8..64949db765 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -568,6 +568,7 @@ export type ModelName = // Gemini | "gemini-pro" | "gemini-1.5-pro-latest" + | "gemini-1.5-flash-latest" // Mistral | "mistral-tiny" | "mistral-small" diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 075832b62d..2f626e0d54 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -58,6 +58,7 @@ const DEFAULT_IGNORE_FILETYPES = [ "*.profraw", "*.gcda", "*.gcno", + "go.sum", ]; export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); export const DEFAULT_IGNORE_DIRS = [ diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 36333326ac..63a7bfe8ea 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -62,6 +62,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "claude-3", "gemini-ultra", "gemini-1.5-pro", + "gemini-1.5-flash", "sonnet", "opus", "haiku", diff --git a/core/llm/index.ts b/core/llm/index.ts index 345fbd91c7..223c7f32b9 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -13,6 +13,7 @@ import { RequestOptions, TemplateType, } from "../index.js"; +import { logDevData } from "../util/devdata.js"; import { DevDataSqliteDb } from "../util/devdataSqlite.js"; import { fetchwithRequestOptions } from "../util/fetchWithOptions.js"; import mergeJson from "../util/merge.js"; @@ -217,7 +218,11 @@ ${settings} ${prompt}`; } - private _logTokensGenerated(model: string, prompt: string, completion: string) { + private _logTokensGenerated( + model: string, + prompt: string, + completion: string, + ) { let promptTokens = this.countTokens(prompt); let generatedTokens = this.countTokens(completion); Telemetry.capture("tokens_generated", { @@ -226,7 +231,18 @@ ${prompt}`; promptTokens: promptTokens, generatedTokens: generatedTokens, }); - DevDataSqliteDb.logTokensGenerated(model, this.providerName, promptTokens, generatedTokens); + DevDataSqliteDb.logTokensGenerated( + model, + this.providerName, + promptTokens, + generatedTokens, + ); + logDevData("tokens_generated", { + model: model, + provider: this.providerName, + promptTokens: promptTokens, + generatedTokens: generatedTokens, + }); } fetch(url: RequestInfo | URL, init?: RequestInit): Promise { @@ -533,4 +549,3 @@ ${prompt}`; } } } - diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index ba1c66c5c7..fcbcbbd81c 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -438,14 +438,12 @@ "properties": { "model": { "enum": [ - "gpt-4-turbo", "gpt-4o", "llama3-70b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", "mistral-8x7b", - "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "starcoder-7b", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index ba1c66c5c7..fcbcbbd81c 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -438,14 +438,12 @@ "properties": { "model": { "enum": [ - "gpt-4-turbo", "gpt-4o", "llama3-70b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", "mistral-8x7b", - "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "starcoder-7b", diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index fcbcbbd81c..80268de2bc 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -610,7 +610,8 @@ "enum": [ "chat-bison-001", "gemini-pro", - "gemini-1.5-pro-latest" + "gemini-1.5-pro-latest", + "gemini-1.5-flash-latest" ] } } @@ -985,6 +986,7 @@ "chat-bison-001", "gemini-pro", "gemini-1.5-pro-latest", + "gemini-1.5-flash-latest", "mistral-tiny", "mistral-small", "mistral-medium", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index e26669615d..06d6642819 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -474,14 +474,12 @@ "properties": { "model": { "enum": [ - "gpt-4-turbo", "gpt-4o", "llama3-70b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", "mistral-8x7b", - "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "starcoder-7b", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 78f6c9e1d1..23be3829e0 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.94", + "version": "0.9.140", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.94", + "version": "0.9.140", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/src/activation/activate.ts b/extensions/vscode/src/activation/activate.ts index cf248110d6..de3ddc872a 100644 --- a/extensions/vscode/src/activation/activate.ts +++ b/extensions/vscode/src/activation/activate.ts @@ -7,6 +7,7 @@ import registerQuickFixProvider from "../lang-server/codeActions"; import { getExtensionVersion } from "../util/util"; import { getExtensionUri } from "../util/vscode"; import { setupInlineTips } from "./inlineTips"; +import { VsCodeContinueApi } from "./api"; export async function activateExtension(context: vscode.ExtensionContext) { // Add necessary files @@ -34,4 +35,12 @@ export async function activateExtension(context: vscode.ExtensionContext) { extensionVersion: getExtensionVersion(), }); } + + const api = new VsCodeContinueApi(vscodeExtension); + const continuePublicApi = { + registerCustomContextProvider: api.registerCustomContextProvider.bind(api), + }; + + // 'export' public api-surface + return continuePublicApi; } diff --git a/extensions/vscode/src/activation/api.ts b/extensions/vscode/src/activation/api.ts new file mode 100644 index 0000000000..03a814ae98 --- /dev/null +++ b/extensions/vscode/src/activation/api.ts @@ -0,0 +1,10 @@ +import { VsCodeExtension } from "../extension/vscodeExtension"; +import { IContextProvider } from "core"; + +export class VsCodeContinueApi { + constructor(private readonly vscodeExtension: VsCodeExtension) {} + + registerCustomContextProvider(contextProvider: IContextProvider) { + this.vscodeExtension.registerCustomContextProvider(contextProvider); + } +} \ No newline at end of file diff --git a/extensions/vscode/src/extension.ts b/extensions/vscode/src/extension.ts index dc164b6eef..e04afe83e7 100644 --- a/extensions/vscode/src/extension.ts +++ b/extensions/vscode/src/extension.ts @@ -9,7 +9,7 @@ import { getExtensionVersion } from "./util/util"; async function dynamicImportAndActivate(context: vscode.ExtensionContext) { const { activateExtension } = await import("./activation/activate"); try { - await activateExtension(context); + return activateExtension(context); } catch (e) { console.log("Error activating extension: ", e); vscode.window @@ -30,7 +30,7 @@ async function dynamicImportAndActivate(context: vscode.ExtensionContext) { } export function activate(context: vscode.ExtensionContext) { - dynamicImportAndActivate(context); + return dynamicImportAndActivate(context); } export function deactivate() { diff --git a/extensions/vscode/src/extension/vscodeExtension.ts b/extensions/vscode/src/extension/vscodeExtension.ts index 4c45822c66..f001b05551 100644 --- a/extensions/vscode/src/extension/vscodeExtension.ts +++ b/extensions/vscode/src/extension/vscodeExtension.ts @@ -1,6 +1,7 @@ import { ConfigHandler } from "core/config/handler"; import { ContinueServerClient } from "core/continueServer/stubs/client"; import { CodebaseIndexer, PauseToken } from "core/indexing/indexCodebase"; +import { IContextProvider } from "core"; import { IdeSettings } from "core/protocol"; import { getConfigJsonPath, getConfigTsPath } from "core/util/paths"; import fs from "fs"; @@ -308,4 +309,8 @@ export class VsCodeExtension { console.log("Codebase Indexing Complete"); } } + + registerCustomContextProvider(contextProvider: IContextProvider) { + this.configHandler.registerCustomContextProvider(contextProvider); + } } diff --git a/gui/src/components/mainInput/inputModifiers.ts b/gui/src/components/mainInput/inputModifiers.ts index f7b5ce8624..cd16b1532a 100644 --- a/gui/src/components/mainInput/inputModifiers.ts +++ b/gui/src/components/mainInput/inputModifiers.ts @@ -2,5 +2,5 @@ import { InputModifiers } from "core"; export const defaultInputModifiers: InputModifiers = { useCodebase: false, - noContext: false, + noContext: true, }; diff --git a/gui/src/util/modelData.ts b/gui/src/util/modelData.ts index a7797bec7b..fb243df608 100644 --- a/gui/src/util/modelData.ts +++ b/gui/src/util/modelData.ts @@ -454,6 +454,18 @@ const gemini15Pro: ModelPackage = { icon: "gemini.png", providerOptions: ["gemini", "freetrial"], }; +const gemini15Flash: ModelPackage = { + title: "Gemini 1.5 Flash", + description: "Fast and versatile multimodal model for scaling across diverse tasks", + params: { + title: "Gemini 1.5 Flash", + model: "gemini-1.5-flash-latest", + contextLength: 1_000_000, + apiKey: "", + }, + icon: "gemini.png", + providerOptions: ["gemini"], +}; const deepseek: ModelPackage = { title: "DeepSeek-Coder", @@ -660,6 +672,7 @@ export const MODEL_INFO: (ModelPackage | string)[] = [ "Gemini", gemini15Pro, geminiPro, + gemini15Flash, "Open Source", llama3Chat, deepseek, @@ -863,7 +876,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { required: true, }, ], - packages: [gemini15Pro, geminiPro], + packages: [gemini15Pro, geminiPro, gemini15Flash], }, mistral: { title: "Mistral API",