Merge branch 'preview' into nate/refactor-core

This commit is contained in:
Nate Sesti 2024-05-23 10:05:27 -07:00
commit 045d98f14e
35 changed files with 25697 additions and 72 deletions

5
.vscode/launch.json vendored
View file

@ -56,7 +56,10 @@
"${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)

5916
binary/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -6,9 +6,9 @@ import {
export const defaultConfig: SerializedContinueConfig = {
models: [
{
title: "GPT-4-Turbo (Free Trial)",
title: "GPT-4o (Free Trial)",
provider: "free-trial",
model: "gpt-4-turbo",
model: "gpt-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
@ -19,13 +19,6 @@ export const defaultConfig: SerializedContinueConfig = {
systemMessage:
"You are an expert software developer. You give helpful and concise responses. Whenever you write a code block you include the language after the opening ticks.",
},
{
title: "GPT-4o (Free Trial)",
provider: "free-trial",
model: "gpt-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
{
title: "Claude 3 Sonnet (Free Trial)",
provider: "free-trial",
@ -50,9 +43,9 @@ export const defaultConfig: SerializedContinueConfig = {
export const defaultConfigJetBrains: SerializedContinueConfig = {
models: [
{
title: "GPT-4-Turbo (Free Trial)",
title: "GPT-4o (Free Trial)",
provider: "free-trial",
model: "gpt-4-turbo",
model: "gpt-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
@ -63,13 +56,6 @@ export const defaultConfigJetBrains: SerializedContinueConfig = {
systemMessage:
"You are an expert software developer. You give helpful and concise responses. Whenever you write a code block you include the language after the opening ticks.",
},
{
title: "GPT-4o (Free Trial)",
provider: "free-trial",
model: "gpt-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
{
title: "Claude 3 Sonnet (Free Trial)",
provider: "free-trial",
@ -129,7 +115,6 @@ export const defaultContextProvidersVsCode: ContextProviderWithParams[] = [
{ name: "code", params: {} },
{ name: "docs", params: {} },
{ name: "diff", params: {} },
{ name: "open", params: {} },
{ name: "terminal", params: {} },
{ name: "problems", params: {} },
{ name: "folder", params: {} },
@ -137,9 +122,7 @@ export const defaultContextProvidersVsCode: ContextProviderWithParams[] = [
];
export const defaultContextProvidersJetBrains: ContextProviderWithParams[] = [
{ name: "code", params: {} },
{ name: "diff", params: {} },
{ name: "open", params: {} },
{ name: "folder", params: {} },
{ name: "codebase", params: {} },
];

View file

@ -2,6 +2,7 @@ import {
BrowserSerializedContinueConfig,
ContinueConfig,
ContinueRcJson,
IContextProvider,
IDE,
ILLM,
} from "../index.js";
@ -12,6 +13,7 @@ import { finalToBrowserConfig, loadFullConfigNode } from "./load.js";
export class ConfigHandler {
private savedConfig: ContinueConfig | undefined;
private savedBrowserConfig?: BrowserSerializedContinueConfig;
private additionalContextProviders: IContextProvider[] = [];
constructor(
private readonly ide: IDE,
@ -84,6 +86,10 @@ export class ConfigHandler {
ideInfo.extensionVersion,
);
(this.savedConfig.contextProviders ?? []).push(
...this.additionalContextProviders,
);
return this.savedConfig;
}
@ -97,4 +103,9 @@ export class ConfigHandler {
return model;
}
registerCustomContextProvider(contextProvider: IContextProvider) {
this.additionalContextProviders.push(contextProvider);
this.reloadConfig();
}
}

View file

@ -7,9 +7,9 @@ export function setupOptimizedMode(
...config,
models: [
{
title: "GPT-4-Turbo (Free Trial)",
title: "GPT-4o (Free Trial)",
provider: "free-trial",
model: "gpt-4-turbo",
model: "gpt-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
@ -20,13 +20,6 @@ export function setupOptimizedMode(
systemMessage:
"You are an expert software developer. You give helpful and concise responses. Whenever you write a code block you include the language after the opening ticks.",
},
{
title: "GPT-4o (Free Trial)",
provider: "free-trial",
model: "gpt-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
{
title: "Claude 3 Sonnet (Free Trial)",
provider: "free-trial",

1
core/index.d.ts vendored
View file

@ -580,6 +580,7 @@ export type ModelName =
// Gemini
| "gemini-pro"
| "gemini-1.5-pro-latest"
| "gemini-1.5-flash-latest"
// Mistral
| "mistral-tiny"
| "mistral-small"

View file

@ -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 = [

View file

@ -62,6 +62,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [
"claude-3",
"gemini-ultra",
"gemini-1.5-pro",
"gemini-1.5-flash",
"sonnet",
"opus",
"haiku",

View file

@ -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";
@ -236,6 +237,12 @@ ${prompt}`;
promptTokens,
generatedTokens,
);
logDevData("tokens_generated", {
model: model,
provider: this.providerName,
promptTokens: promptTokens,
generatedTokens: generatedTokens,
});
}
fetch(url: RequestInfo | URL, init?: RequestInit): Promise<Response> {

View file

@ -11,6 +11,8 @@ class FreeTrial extends BaseLLM {
private async _getHeaders() {
return {
uniqueId: this.uniqueId || "None",
extensionVersion: Telemetry.extensionVersion ?? "Unknown",
os: Telemetry.os ?? "Unknown",
"Content-Type": "application/json",
...(await getHeaders()),
};
@ -126,9 +128,7 @@ class FreeTrial extends BaseLLM {
"llama3-70b",
"gpt-3.5-turbo",
"gpt-4o",
"gpt-4-turbo",
"gemini-1.5-pro-latest",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
];

7734
core/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -167,14 +167,13 @@ If you select some code to be edited, you can have the context provider filter o
### Jira Issues
Type '@jira' to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens).
Type '@jira' to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email.
```json
{
"name": "jira",
"params": {
"domain": "company.atlassian.net",
"email": "someone@somewhere.com",
"token ": "ATATT..."
}
}

View file

@ -58,9 +58,9 @@ Groq provides lightning fast inference for open-source LLMs like Llama3, up to t
{
"models": [
{
"title": "GPT-4-Turbo",
"title": "GPT-4o",
"provider": "openai",
"model": "gpt-4-turbo",
"model": "gpt-4o",
"apiKey": "YOUR_API_KEY"
}
]

View file

@ -67,10 +67,22 @@ Continue can be used in [code-server](https://coder.com/), but if you are runnin
## Download the latest pre-release
### VS Code
We are constantly making fixes and improvements to Continue, but the latest changes remain in a "pre-release" version for roughly a week so that we can test their stability. If you are experiencing issues, you can try the pre-release by going to the Continue extension page in VS Code and selecting "Switch to Pre-Release" as shown below.
![Pre-Release](../static/img/prerelease.png)
### JetBrains
On JetBrains, the "pre-release" happens through their Early Access Program (EAP) channel. To download the latest EAP version, enable the EAP channel:
1. Open JetBrains settings (cmd/ctrl+,) and go to "Plugins"
2. Click the gear icon at the top
3. Select "Manage Plugin Repositories..."
4. Add "https://plugins.jetbrains.com/plugins/eap/list" to the list
5. You'll now always be able to download the latest EAP version from the marketplace
## Download an Older Version
If you've tried everything, reported an error, know that a previous version was working for you, and are waiting to hear back, you can try downloading an older version of the extension.

View file

@ -82,13 +82,13 @@ We also support other methods of generating embeddings, which can be configured
### Ollama
[Ollama](https://ollama.ai) is the easiest way to get up and running with open-source language models. It provides an entirely local REST API for working with LLMs, including generating embeddings. The embeddings generated are slightly larger, with a size of 4096 for `codellama:7b`.
[Ollama](https://ollama.ai) is the easiest way to get up and running with open-source language models. It provides an entirely local REST API for working with LLMs, including generating embeddings. We recommend using an embeddings model like `nomic-embed-text`:
```json title="~/.continue/config.json"
{
"embeddingsProvider": {
"provider": "ollama",
"model": "codellama:7b",
"model": "nomic-embed-text",
"apiBase": "http://localhost:11434" // optional, defaults to http://localhost:11434
}
}

View file

@ -0,0 +1,73 @@
# Prompt files (experimental)
Prompt (`.prompt`) files are an easy way to build and share LLM prompts with others. The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), and adds templating so that you can easily refer to files, your current git diff, and eventually much more.
## How to create a prompt file
Below is a quick example of setting up a prompt file to write unit tests:s
1. Create a folder called `.prompts` at the top level of your repository
2. Add a file called `test.prompt` to this folder
3. Write the following contents to `test.prompt` and save
```
temperature: 0.5
maxTokens: 4096
---
<system>
You are an expert programmer
</system>
{{{ input }}}
Write unit tests for the above selected code, following each of these instructions:
- Use `jest`
- Properly set up and tear down
- Include important edge cases
- The tests should be complete and sophisticated
- Give the tests just as chat output, don't edit any file
- Don't explain how to set up `jest`
```
Now to use this prompt, you can highlight code and use cmd/ctrl+L to select it in the Continue sidebar. Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file.
## Syntax
> The current state of this format is experimental and subject to change
### Preamble
The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters:
- `temperature`
- `topP`
- `topK`
- `minP`
- `presencePenalty`
- `frequencyPenalty`
- `mirostat`
- `stop`
- `maxTokens`
- `name`
- `description`
If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator.
### Body
The "body" is everything below the `---` separator, and contains your prompt.
At its most basic, the body can be just text.
To add a system message, start the body with `<system></system>` tags like in the example above and place your system message inside.
The body also supports templating with [Handlebars syntax](https://handlebarsjs.com/guide/). The following variables are currently available:
- `input`: The full text from the input box in the sidebar that is sent along with the slash command
- `diff`: The current git diff in your workspace
We plan to add support soon for templating with all [context providers](../customization/context-providers.md).
## Feedback
If you have ideas about how to improve the `.prompt` file format, please reach out on [Discord](https://discord.gg/NWtdYexhMs).

View file

@ -137,7 +137,8 @@ Follow these steps to ensure that everything is set up correctly:
3. Run `ollama run starcoder2:3b` to verify that the model is downloaded.
4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
5. Check the output of the logs to find any potential errors (cmd/ctrl+shift+p -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/core.log in JetBrains).
6. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible.
6. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use cmd/ctrl+, then search for this and check the box)
7. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible.
### Completions are slow

View file

@ -67,7 +67,7 @@ const config = {
},
],
// Replace with your project's social card
image: "img/continue-social-card.png",
image: "https://docs.continue.dev/img/continue-social-card.png",
navbar: {
title: "Continue",
logo: {

View file

@ -50,6 +50,7 @@ const sidebars = {
"walkthroughs/running-continue-without-internet",
"walkthroughs/codebase-embeddings",
"walkthroughs/tab-autocomplete",
"walkthroughs/prompt-files",
// "walkthroughs/config-file-migration",
],
},

View file

@ -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",

View file

@ -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",

View file

@ -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",
@ -612,7 +610,8 @@
"enum": [
"chat-bison-001",
"gemini-pro",
"gemini-1.5-pro-latest"
"gemini-1.5-pro-latest",
"gemini-1.5-flash-latest"
]
}
}
@ -987,6 +986,7 @@
"chat-bison-001",
"gemini-pro",
"gemini-1.5-pro-latest",
"gemini-1.5-flash-latest",
"mistral-tiny",
"mistral-small",
"mistral-medium",

View file

@ -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",

View file

@ -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",

View file

@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/icon.png",
"version": "0.9.94",
"version": "0.9.140",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

11852
extensions/vscode/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -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";
let resolveVsCodeExtension = (_: VsCodeExtension): void => {};
export const vscodeExtensionPromise: Promise<VsCodeExtension> = new Promise(
@ -39,4 +40,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;
}

View file

@ -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);
}
}

View file

@ -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() {

View file

@ -1,8 +1,9 @@
import { ConfigHandler } from "core/config/handler.js";
import { IContextProvider } from "core";
import { ConfigHandler } from "core/config/handler";
import { Core } from "core/core";
import { FromCoreProtocol, ToCoreProtocol } from "core/protocol/index.js";
import { InProcessMessenger } from "core/util/messenger.js";
import { getConfigJsonPath, getConfigTsPath } from "core/util/paths.js";
import { FromCoreProtocol, ToCoreProtocol } from "core/protocol";
import { InProcessMessenger } from "core/util/messenger";
import { getConfigJsonPath, getConfigTsPath } from "core/util/paths";
import fs from "fs";
import { v4 as uuidv4 } from "uuid";
import * as vscode from "vscode";
@ -235,4 +236,8 @@ export class VsCodeExtension {
static continueVirtualDocumentScheme = "continue";
private PREVIOUS_BRANCH_FOR_WORKSPACE_DIR: { [dir: string]: string } = {};
registerCustomContextProvider(contextProvider: IContextProvider) {
this.configHandler.registerCustomContextProvider(contextProvider);
}
}

View file

@ -26,6 +26,7 @@ import { getFontSize, isMetaEquivalentKeyPressed } from "../util";
import { getLocalStorage } from "../util/localStorage";
import HeaderButtonWithText from "./HeaderButtonWithText";
import TextDialog from "./dialogs";
import { ftl } from "./dialogs/FTCDialog";
import IndexingProgressBar from "./loaders/IndexingProgressBar";
import ProgressBar from "./loaders/ProgressBar";
import ModelSelect from "./modelSelection/ModelSelect";
@ -238,12 +239,10 @@ const Layout = () => {
<div className="mr-auto flex gap-2 items-center">
<ModelSelect />
{indexingState.status !== "indexing" && // Would take up too much space together with indexing progress
defaultModel?.provider === "free-trial" &&
(location.pathname === "/settings" ||
parseInt(localStorage.getItem("ftc") || "0") >= 10) && (
defaultModel?.provider === "free-trial" && (
<ProgressBar
completed={parseInt(localStorage.getItem("ftc") || "0")}
total={100}
total={ftl()}
/>
)}

View file

@ -14,6 +14,14 @@ const GridDiv = styled.div`
align-items: center;
`;
export const ftl = () => {
const ftc = parseInt(localStorage.getItem("ftc"));
if (ftc && ftc > 52) {
return 100;
}
return 50;
};
function FTCDialog() {
const navigate = useNavigate();
const [apiKey, setApiKey] = React.useState("");
@ -24,9 +32,9 @@ function FTCDialog() {
<div className="p-4">
<h3>Free Trial Limit Reached</h3>
<p>
You've reached the free trial limit of 100 free inputs. To keep using
Continue, you can either use your own API key, or use a local LLM. To
read more about the options, see our{" "}
You've reached the free trial limit of {ftl()} free inputs. To keep
using Continue, you can either use your own API key, or use a local LLM.
To read more about the options, see our{" "}
<a
href="https://docs.continue.dev/customization/models"
target="_blank"

View file

@ -2,5 +2,5 @@ import { InputModifiers } from "core";
export const defaultInputModifiers: InputModifiers = {
useCodebase: false,
noContext: false,
noContext: true,
};

View file

@ -27,7 +27,7 @@ import {
vscBackground,
vscForeground,
} from "../components";
import FTCDialog from "../components/dialogs/FTCDialog";
import FTCDialog, { ftl } from "../components/dialogs/FTCDialog";
import StepContainer from "../components/gui/StepContainer";
import TimelineItem from "../components/gui/TimelineItem";
import ContinueInputBox from "../components/mainInput/ContinueInputBox";
@ -246,7 +246,7 @@ function GUI(props: GUIProps) {
if (u) {
setLocalStorage("ftc", u + 1);
if (u >= 100) {
if (u >= ftl()) {
dispatch(setShowDialog(true));
dispatch(setDialogMessage(<FTCDialog />));
posthog?.capture("ftc_reached");

View file

@ -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: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini"],
};
const deepseek: ModelPackage = {
title: "DeepSeek-Coder",
@ -546,7 +558,7 @@ const gpt4turbo: ModelPackage = {
contextLength: 128_000,
title: "GPT-4 Turbo",
},
providerOptions: ["openai", "freetrial"],
providerOptions: ["openai"],
icon: "openai.png",
};
@ -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",
@ -1039,7 +1052,6 @@ After it's up and running, you can start using Continue.`,
{ ...claude3Haiku, title: "Claude 3 Haiku (trial)" },
{ ...gemini15Pro, title: "Gemini 1.5 Pro (trial)" },
{ ...gpt4o, title: "GPT-4o (trial)" },
{ ...gpt4turbo, title: "GPT-4-Turbo (trial)" },
{ ...gpt35turbo, title: "GPT-3.5-Turbo (trial)" },
{
...AUTODETECT,