Merge branch 'continuedev:dev' into dev

This commit is contained in:
Samir Abis 2024-07-27 14:12:29 +02:00 • committed by GitHub
commit 7497fc0fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 1020 additions and 233 deletions

View file

@ -0,0 +1,4 @@
project: extensions/vscode
kind: Added
body: Support for Llama 3.1 and gpt-4o-mini
time: 2024-07-26T15:35:14.411895-07:00

View file

@ -0,0 +1,4 @@
project: extensions/vscode
kind: Changed
body: Significant improvements to indexing performance
time: 2024-07-26T15:34:58.457908-07:00

View file

@ -0,0 +1,5 @@
project: extensions/vscode
kind: Changed
body: Improved @codebase quality by more accurately searching over file names and
paths
time: 2024-07-26T15:35:42.390496-07:00

View file

@ -158,11 +158,18 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
);
});
fs.copyFileSync(
path.join(__dirname, "../core/vendor/tree-sitter.wasm"),
path.join(__dirname, "out/tree-sitter.wasm"),
);
console.log("[info] Copied tree-sitter wasms");
const filesToCopy = [
"../core/vendor/tree-sitter.wasm",
"../core/llm/llamaTokenizerWorkerPool.mjs",
"../core/llm/llamaTokenizer.mjs",
];
for (const f of filesToCopy) {
fs.copyFileSync(
path.join(__dirname, f),
path.join(__dirname, "out", path.basename(f)),
);
console.log(`[info] Copied ${path.basename(f)}`);
}
console.log("[info] Cleaning up artifacts from previous builds...");

View file

@ -169,19 +169,24 @@ const codegeexFimTemplate: AutocompleteTemplate = {
filepath,
]);
const baseTemplate = `###PATH:${relativePaths[relativePaths.length - 1]}\n###LANGUAGE:\n###MODE:BLOCK\n<|code_suffix|>${suffix}<|code_prefix|>${prefix}<|code_middle|>`;
if (snippets.length == 0)
{
if (snippets.length == 0) {
return `<|user|>\n${baseTemplate}<|assistant|>\n`;
}
const references =
`###REFERENCE:\n${snippets
const references = `###REFERENCE:\n${snippets
.map((snippet, i) => `###PATH:${relativePaths[i]}\n${snippet.contents}\n`)
.join("###REFERENCE:\n")}`;
const prompt = `<|user|>\n${references}\n${baseTemplate}<|assistant|>\n`;
return prompt;
},
completionOptions: {
stop: ["<|user|>", "<|code_suffix|>", "<|code_prefix|>", "<|code_middle|>", "<|assistant|>", "<|endoftext|>"],
stop: [
"<|user|>",
"<|code_suffix|>",
"<|code_prefix|>",
"<|code_middle|>",
"<|assistant|>",
"<|endoftext|>",
],
},
};

View file

@ -3,7 +3,7 @@ import {
SlashCommand,
SlashCommandDescription,
} from "../index.js";
import { stripImages } from "../llm/countTokens.js";
import { stripImages } from "../llm/images.js";
import { renderTemplatedString } from "../llm/llms/index.js";
import SlashCommands from "./slash/index.js";

View file

@ -1,5 +1,5 @@
import { SlashCommand } from "../../index.js";
import { stripImages } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
const CommitMessageCommand: SlashCommand = {
name: "commit",

View file

@ -1,5 +1,5 @@
import { ChatMessage, SlashCommand } from "../../index.js";
import { stripImages } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
import { removeQuotesAndEscapes } from "../../util/index.js";
const PROMPT = (

View file

@ -8,7 +8,7 @@ import {
} from "../../autocomplete/lineStream.js";
import { streamLines } from "../../diff/util.js";
import { ContextItemWithId, ILLM, SlashCommand } from "../../index.js";
import { stripImages } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
import {
dedentAndGetCommonWhitespace,
getMarkdownLanguageTagForFile,

View file

@ -1,5 +1,5 @@
import { ChatMessage, SlashCommand } from "../../index.js";
import { stripImages } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
const prompt = `
Review the following code, focusing on Readability, Maintainability, Code Smells, Speed, and Memory Performance. Provide feedback with these guidelines:

View file

@ -3,7 +3,7 @@ import { homedir } from "node:os";
import path from "path";
import { languageForFilepath } from "../../autocomplete/constructPrompt.js";
import { SlashCommand } from "../../index.js";
import { stripImages } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
// If useful elsewhere, helper funcs should move to core/util/index.ts or similar
function getOffsetDatetime(date: Date): Date {

View file

@ -1,6 +1,7 @@
import { constants } from "../../deploy/constants.js";
import { ChatMessageRole, FetchFunction, SlashCommand } from "../../index.js";
import { pruneStringFromBottom, stripImages } from "../../llm/countTokens.js";
import { pruneStringFromBottom } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
const PROMPT = (
input: string,

View file

@ -197,7 +197,7 @@ export class ConfigHandler {
async setSelectedProfile(profileId: string) {
this.selectedProfileId = profileId;
const newConfig = await this.loadConfig();
this.notifyConfigListerners(newConfig);
this.notifyConfigListeners(newConfig);
const selectedProfiles =
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
selectedProfiles[await this.getWorkspaceId()] = profileId;
@ -241,7 +241,7 @@ export class ConfigHandler {
}
}
private notifyConfigListerners(newConfig: ContinueConfig) {
private notifyConfigListeners(newConfig: ContinueConfig) {
// Notify listeners that config changed
for (const listener of this.updateListeners) {
listener(newConfig);
@ -257,7 +257,7 @@ export class ConfigHandler {
// TODO: this isn't right, there are two different senses in which you want to "reload"
const newConfig = await this.currentProfile.reloadConfig();
this.inactiveProfiles.forEach((profile) => profile.clearConfig());
this.notifyConfigListerners(newConfig);
this.notifyConfigListeners(newConfig);
}
getSerializedConfig(): Promise<BrowserSerializedContinueConfig> {

View file

@ -36,6 +36,7 @@ import CustomLLMClass from "../llm/llms/CustomLLM.js";
import FreeTrial from "../llm/llms/FreeTrial.js";
import { llmFromDescription } from "../llm/llms/index.js";
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider.js";
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider.js";
import { fetchwithRequestOptions } from "../util/fetchWithOptions.js";
import { copyOf } from "../util/index.js";
@ -60,7 +61,6 @@ import {
getPromptFiles,
slashCommandFromPromptFile,
} from "./promptFile.js";
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider.js";
const { execSync } = require("child_process");

View file

@ -3,7 +3,7 @@ import path from "path";
import * as YAML from "yaml";
import type { IDE, SlashCommand } from "..";
import { walkDir } from "../indexing/walkDir";
import { stripImages } from "../llm/countTokens.js";
import { stripImages } from "../llm/images";
import { renderTemplatedString } from "../llm/llms/index.js";
import { getBasename } from "../util/index.js";

View file

@ -8,7 +8,6 @@ import { getRelativePath } from "../../util/index.js";
import { RetrievalPipelineOptions } from "./pipelines/BaseRetrievalPipeline.js";
import NoRerankerRetrievalPipeline from "./pipelines/NoRerankerRetrievalPipeline.js";
import RerankerRetrievalPipeline from "./pipelines/RerankerRetrievalPipeline.js";
import { recentlyEditedFilesCache } from "./recentlyEditedFilesCache.js";
export async function retrieveContextItemsFromEmbeddings(
extras: ContextProviderExtras,

View file

@ -16,8 +16,10 @@ import {
} from "./config/onboarding.js";
import { createNewPromptFile } from "./config/promptFile.js";
import { addModel, addOpenAIKey, deleteModel } from "./config/util.js";
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache.js";
import { ContinueServerClient } from "./continueServer/stubs/client.js";
import { ControlPlaneClient } from "./control-plane/client.js";
import { getAuthUrlForTokenPage } from "./control-plane/auth/index.js";
import { ControlPlaneClient } from "./control-plane/client";
import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer.js";
import { DocsService } from "./indexing/docs/DocsService.js";
import Ollama from "./llm/llms/Ollama.js";
@ -31,8 +33,6 @@ import type { IMessenger, Message } from "./util/messenger";
import { editConfigJson } from "./util/paths.js";
import { Telemetry } from "./util/posthog.js";
import { streamDiffLines } from "./util/verticalEdit.js";
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache.js";
import { getAuthUrlForTokenPage } from "./control-plane/auth/index.js";
export class Core {
// implements IMessenger<ToCoreProtocol, FromCoreProtocol>

View file

@ -1,6 +1,6 @@
import { distance } from "fastest-levenshtein";
import { ChatMessage } from "../index.js";
import { stripImages } from "../llm/countTokens.js";
import { stripImages } from "../llm/images.js";
export type LineStream = AsyncGenerator<string>;

View file

@ -105,13 +105,15 @@ export class ChunkCodebaseIndex implements CodebaseIndex {
const item = results.compute[i];
// Insert chunks
for await (const chunk of chunkDocument({
filepath: item.path,
contents: contents[i],
maxChunkSize: this.maxChunkSize,
digest: item.cacheKey,
})) {
handleChunk(chunk);
if (contents.length) {
for await (const chunk of chunkDocument({
filepath: item.path,
contents: contents[i],
maxChunkSize: this.maxChunkSize,
digest: item.cacheKey,
})) {
await handleChunk(chunk);
}
}
accumulatedProgress =
@ -132,13 +134,15 @@ export class ChunkCodebaseIndex implements CodebaseIndex {
const item = results.addTag[i];
// Insert chunks
for await (const chunk of chunkDocument({
filepath: item.path,
contents: contents[i],
maxChunkSize: this.maxChunkSize,
digest: item.cacheKey,
})) {
handleChunk(chunk);
if (contents.length) {
for await (const chunk of chunkDocument({
filepath: item.path,
contents: contents[i],
maxChunkSize: this.maxChunkSize,
digest: item.cacheKey,
})) {
handleChunk(chunk);
}
}
markComplete([item], IndexResultType.AddTag);

View file

@ -1,10 +1,10 @@
import { ChunkWithoutID } from "../../index.js";
import { countTokens } from "../../llm/countTokens.js";
import { countTokensAsync } from "../../llm/countTokens.js";
export function* basicChunker(
export async function* basicChunker(
contents: string,
maxChunkSize: number,
): Generator<ChunkWithoutID> {
): AsyncGenerator<ChunkWithoutID> {
if (contents.trim().length === 0) {
return;
}
@ -14,18 +14,24 @@ export function* basicChunker(
let startLine = 0;
let currLine = 0;
for (const line of contents.split("\n")) {
const lineTokens = countTokens(line);
if (chunkTokens + lineTokens > maxChunkSize - 5) {
const lineTokens = await Promise.all(contents.split("\n").map(async l => {
return {
line: l,
tokenCount: await countTokensAsync(l),
};
}));
for (const lt of lineTokens) {
if (chunkTokens + lt.tokenCount > maxChunkSize - 5) {
yield { content: chunkContent, startLine, endLine: currLine - 1 };
chunkContent = "";
chunkTokens = 0;
startLine = currLine;
}
if (lineTokens < maxChunkSize) {
chunkContent += `${line}\n`;
chunkTokens += lineTokens + 1;
if (lt.tokenCount < maxChunkSize) {
chunkContent += `${lt.line}\n`;
chunkTokens += lt.tokenCount + 1;
}
currLine++;

View file

@ -1,5 +1,5 @@
import { Chunk, ChunkWithoutID } from "../../index.js";
import { countTokens } from "../../llm/countTokens.js";
import { countTokens, countTokensAsync } from "../../llm/countTokens.js";
import { supportedLanguages } from "../../util/treeSitter.js";
import { basicChunker } from "./basic.js";
import { codeChunker } from "./code.js";
@ -44,25 +44,34 @@ export async function* chunkDocument({
digest,
}: ChunkDocumentParam): AsyncGenerator<Chunk> {
let index = 0;
const chunkPromises: Promise<Chunk | undefined>[] = [];
for await (const chunkWithoutId of chunkDocumentWithoutId(
filepath,
contents,
maxChunkSize,
)) {
if (countTokens(chunkWithoutId.content) > maxChunkSize) {
console.warn(
`Chunk with more than ${maxChunkSize} tokens constructed: `,
chunkPromises.push(new Promise(async (resolve) => {
if (await countTokensAsync(chunkWithoutId.content) > maxChunkSize) {
console.warn(
`Chunk with more than ${maxChunkSize} tokens constructed: `,
filepath,
countTokens(chunkWithoutId.content),
);
return resolve(undefined);
}
resolve({
...chunkWithoutId,
digest,
index,
filepath,
countTokens(chunkWithoutId.content),
);
continue;
}
yield {
...chunkWithoutId,
digest,
index,
filepath,
};
});
}));
index++;
}
for await (const chunk of chunkPromises) {
if (!chunk) {
continue;
}
yield chunk;
}
}

View file

@ -1,6 +1,6 @@
import { SyntaxNode } from "web-tree-sitter";
import { ChunkWithoutID } from "../../index.js";
import { countTokens } from "../../llm/countTokens.js";
import { countTokens, countTokensAsync } from "../../llm/countTokens.js";
import { getParserForFile } from "../../util/treeSitter.js";
function collapsedReplacement(node: SyntaxNode): string {
@ -22,14 +22,14 @@ function firstChild(
return node.children.find((child) => child.type === grammarName) || null;
}
function collapseChildren(
async function collapseChildren(
node: SyntaxNode,
code: string,
blockTypes: string[],
collapseTypes: string[],
collapseBlockTypes: string[],
maxChunkSize: number,
): string {
): Promise<string> {
code = code.slice(0, node.endIndex);
const block = firstChild(node, blockTypes);
const collapsedChildren = [];
@ -58,7 +58,7 @@ function collapseChildren(
code = code.slice(node.startIndex);
let removedChild = false;
while (
countTokens(code.trim()) > maxChunkSize &&
(await countTokensAsync(code.trim())) > maxChunkSize &&
collapsedChildren.length > 0
) {
removedChild = true;
@ -106,11 +106,11 @@ export const FUNCTION_DECLARATION_NODE_TYPEs = [
"method_declaration",
];
function constructClassDefinitionChunk(
async function constructClassDefinitionChunk(
node: SyntaxNode,
code: string,
maxChunkSize: number,
): string {
): Promise<string> {
return collapseChildren(
node,
code,
@ -121,11 +121,11 @@ function constructClassDefinitionChunk(
);
}
function constructFunctionDefinitionChunk(
async function constructFunctionDefinitionChunk(
node: SyntaxNode,
code: string,
maxChunkSize: number,
): string {
): Promise<string> {
const bodyNode = node.children[node.children.length - 1];
const funcText =
code.slice(node.startIndex, bodyNode.startIndex) +
@ -153,7 +153,7 @@ const collapsedNodeConstructors: {
node: SyntaxNode,
code: string,
maxChunkSize: number,
) => string;
) => Promise<string>;
} = {
// Classes, structs, etc
class_definition: constructClassDefinitionChunk,
@ -165,37 +165,50 @@ const collapsedNodeConstructors: {
function_item: constructFunctionDefinitionChunk,
};
function* getSmartCollapsedChunks(
async function maybeYieldChunk(
node: SyntaxNode,
code: string,
maxChunkSize: number,
root = true,
): Generator<ChunkWithoutID> {
): Promise<ChunkWithoutID | undefined> {
// Keep entire text if not over size
if (
(root || node.type in collapsedNodeConstructors) &&
countTokens(node.text) < maxChunkSize
) {
yield {
content: node.text,
startLine: node.startPosition.row,
endLine: node.endPosition.row,
};
if (root || node.type in collapsedNodeConstructors) {
const tokenCount = await countTokensAsync(node.text);
if (tokenCount < maxChunkSize) {
return {
content: node.text,
startLine: node.startPosition.row,
endLine: node.endPosition.row,
};
}
}
return undefined;
}
async function* getSmartCollapsedChunks(
node: SyntaxNode,
code: string,
maxChunkSize: number,
root = true,
): AsyncGenerator<ChunkWithoutID> {
const chunk = await maybeYieldChunk(node, code, maxChunkSize, root);
if (chunk) {
yield chunk;
return;
}
// If a collapsed form is defined, use that
if (node.type in collapsedNodeConstructors) {
yield {
content: collapsedNodeConstructors[node.type](node, code, maxChunkSize),
content: await collapsedNodeConstructors[node.type](node, code, maxChunkSize),
startLine: node.startPosition.row,
endLine: node.endPosition.row,
};
}
// Recurse (because even if collapsed version was shown, want to show the children in full somewhere)
for (const child of node.children) {
yield* getSmartCollapsedChunks(child, code, maxChunkSize, false);
const generators = node.children.map((child) => getSmartCollapsedChunks(child, code, maxChunkSize, false));
for (const generator of generators) {
yield* generator;
}
}

View file

@ -78,7 +78,7 @@ export async function* markdownChunker(
if (hLevel > 4) {
const header = findHeader(content.split("\n"));
for (const chunk of basicChunker(content, maxChunkSize)) {
for await (const chunk of basicChunker(content, maxChunkSize)) {
yield {
...chunk,
otherMetadata: {

47
core/llm/asyncEncoder.ts Normal file
View file

@ -0,0 +1,47 @@
import llamaTokenizer from "./llamaTokenizer.js";
import { Tiktoken, encodingForModel as _encodingForModel } from "js-tiktoken";
import workerpool from "workerpool";
import * as path from "path";
export interface AsyncEncoder {
encode(text: string): Promise<number[]>;
decode(tokens: number[]): string;
}
export class LlamaAsyncEncoder implements AsyncEncoder {
private workerPool: workerpool.Pool;
constructor() {
this.workerPool = workerpool.pool(path.join(__dirname, "/llamaTokenizerWorkerPool.mjs"));
}
async encode(text: string): Promise<number[]> {
return this.workerPool.exec("encode", [text]);
}
decode(tokens: number[]): string {
return llamaTokenizer.decode(tokens);
}
// TODO: this should be called somewhere before exit or potentially with a shutdown hook
public async close(): Promise<void> {
await this.workerPool.terminate();
}
}
// this class does not yet do anything asynchronous
export class GPTAsyncEncoder implements AsyncEncoder {
private tiktokenEncoding: Tiktoken;
constructor() {
this.tiktokenEncoding = _encodingForModel("gpt-4");
}
async encode(text: string): Promise<number[]> {
return this.tiktokenEncoding.encode(text, "all", []);
}
decode(tokens: number[]): string {
return this.tiktokenEncoding.decode(tokens);
}
}

View file

@ -3,27 +3,35 @@ import { ChatMessage, MessageContent, MessagePart } from "../index.js";
import { autodetectTemplateType } from "./autodetect.js";
import { TOKEN_BUFFER_FOR_SAFETY } from "./constants.js";
import llamaTokenizer from "./llamaTokenizer.js";
import { AsyncEncoder, GPTAsyncEncoder, LlamaAsyncEncoder } from "./asyncEncoder.js";
import { stripImages } from "./images.js";
interface Encoding {
encode: Tiktoken["encode"];
decode: Tiktoken["decode"];
}
class LlamaEncoding implements Encoding {
encode(
text: string,
allowedSpecial?: string[] | "all" | undefined,
disallowedSpecial?: string[] | "all" | undefined,
): number[] {
encode(text: string): number[] {
return llamaTokenizer.encode(text);
}
decode(tokens: number[]): string {
return llamaTokenizer.decode(tokens);
}
}
let gptEncoding: Encoding | null = null;
const gptAsyncEncoder = new GPTAsyncEncoder();
const llamaEncoding = new LlamaEncoding();
const llamaAsyncEncoder = new LlamaAsyncEncoder();
function asyncEncoderForModel(modelName: string): AsyncEncoder {
const modelType = autodetectTemplateType(modelName);
if (!modelType || modelType === "none") {
return gptAsyncEncoder;
}
return llamaAsyncEncoder;
}
function encodingForModel(modelName: string): Encoding {
const modelType = autodetectTemplateType(modelName);
@ -46,6 +54,24 @@ function countImageTokens(content: MessagePart): number {
throw new Error("Non-image content type");
}
async function countTokensAsync(
content: MessageContent,
// defaults to llama2 because the tokenizer tends to produce more tokens
modelName = "llama2",
): Promise<number> {
const encoding = asyncEncoderForModel(modelName);
if (Array.isArray(content)) {
const promises = content.map(async part => {
if (part.type === "imageUrl") {
return countImageTokens(part);
}
return (await encoding.encode(part.text ?? "")).length;
});
return (await Promise.all(promises)).reduce((sum, val) => sum + val, 0);
}
return (await encoding.encode(content ?? "")).length;
}
function countTokens(
content: MessageContent,
// defaults to llama2 because the tokenizer tends to produce more tokens
@ -79,16 +105,6 @@ function flattenMessages(msgs: ChatMessage[]): ChatMessage[] {
return flattened;
}
export function stripImages(content: MessageContent): string {
if (Array.isArray(content)) {
return content
.filter((part) => part.type === "text")
.map((part) => part.text)
.join("\n");
}
return content;
}
function countChatMessageTokens(
modelName: string,
chatMessage: ChatMessage,
@ -360,6 +376,7 @@ function compileChatMessages(
export {
compileChatMessages,
countTokens,
countTokensAsync,
pruneLinesFromBottom,
pruneLinesFromTop,
pruneRawPromptFromTop,

11
core/llm/images.ts Normal file
View file

@ -0,0 +1,11 @@
import { MessageContent } from "../index.js";
export function stripImages(content: MessageContent): string {
if (Array.isArray(content)) {
return content
.filter((part) => part.type === "text")
.map((part) => part.text)
.join("\n");
}
return content;
}

View file

@ -36,9 +36,9 @@ import {
compileChatMessages,
countTokens,
pruneRawPromptFromTop,
stripImages,
} from "./countTokens.js";
import CompletionOptionsForModels from "./templates/options.js";
import { stripImages } from "./images.js";
export abstract class BaseLLM implements ILLM {
static providerName: ModelProvider;

486
core/llm/llamaTokenizer.mjs Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
import workerpool from "workerpool";
import llamaTokenizer from "./llamaTokenizer.mjs";
function encode(segment) {
return llamaTokenizer.encode(segment);
}
workerpool.worker({
encode,
});

View file

@ -4,7 +4,7 @@ import {
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
import { streamSse } from "../stream.js";

View file

@ -10,7 +10,7 @@ import {
MessageContent,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
class Bedrock extends BaseLLM {

View file

@ -1,6 +1,6 @@
import { BaseLLM } from "../index.js";
import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { streamSse } from "../stream.js";
export default class Cloudflare extends BaseLLM {

View file

@ -5,7 +5,7 @@ import {
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { streamJSON } from "../stream.js";
class Cohere extends BaseLLM {

View file

@ -5,7 +5,7 @@ import {
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
interface IFlowiseApiOptions {

View file

@ -5,7 +5,7 @@ import {
MessagePart,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
import { streamResponse } from "../stream.js";

View file

@ -4,7 +4,7 @@ import {
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
import { streamResponse } from "../stream.js";

View file

@ -4,7 +4,7 @@ import {
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
import { streamSse } from "../stream.js";

View file

@ -1,5 +1,5 @@
import { ChatMessage } from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
function templateFactory(
systemMessage: (msg: ChatMessage) => string,

View file

@ -59,6 +59,7 @@
"vectordb": "^0.4.20",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"workerpool": "^9.1.3",
"yaml": "^2.4.2",
"zod": "^3.23.8"
},
@ -13787,6 +13788,11 @@
"node": ">=12.17"
}
},
"node_modules/workerpool": {
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.1.3.tgz",
"integrity": "sha512-LhUrk4tbxJRDQmRrrFWA9EnboXI79fe0ZNTy3u8m+dqPN1EkVSIsQYAB8OF/fkyhG8Rtup+c/bzj/+bzbG8fqg=="
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",

View file

@ -80,6 +80,7 @@
"vectordb": "^0.4.20",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"workerpool": "^9.1.3",
"yaml": "^2.4.2",
"zod": "^3.23.8"
},

View file

@ -15,7 +15,7 @@ async function genToStrs(
return (await genToArr(generator)).map((chunk) => chunk.content);
}
describe("codeChunker", () => {
describe.skip("codeChunker", () => {
test("should return empty array if file empty", async () => {
const chunks = await genToStrs(codeChunker("test.ts", "", 100));
expect(chunks).toEqual([]);

View file

@ -4,49 +4,34 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## 0.0.42 - 2024-04-12
### Added
- Inline cmd/ctrl+I in JetBrains
* Inline cmd/ctrl+I in JetBrains
### Fixed
- Fixed character encoding error causing display issues
- Fixed error causing input to constantly demand focus
- Fixed automatic reloading of config.json
* Fixed character encoding error causing display issues
* Fixed error causing input to constantly demand focus
* Fixed automatic reloading of config.json
## 0.0.38 - 2024-03-15
### Added
- Remote config server support
- Autocomplete support in JetBrains
* Remote config server support
* Autocomplete support in JetBrains
## 0.0.34 - 2024-03-03
### Added
- diff context provider
* diff context provider
### Changed
- Allow LLM servers to handle templating
* Allow LLM servers to handle templating
### Fixed
- Fix a few context providers / slash commands
- Fixed issues preventing proper extension startup
* Fix a few context providers / slash commands
* Fixed issues preventing proper extension startup
## v0.0.26 - 2023-12-28
### Added
- auto-reloading of config on save
* auto-reloading of config on save
### Fixed
- Fixed /edit bug for versions without Python server
* Fixed /edit bug for versions without Python server
## v0.0.25 - 2023-12-25

View file

@ -14,7 +14,6 @@ import java.awt.Desktop
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import net.minidev.json.JSONObject
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
@ -34,15 +33,19 @@ class ContinueAuthService {
// private const val CONTROL_PLANE_URL = "http://localhost:3001"
}
init {
setupRefreshTokenInterval()
}
fun startAuthFlow(project: Project) {
// Open login page
openSignInPage(project)
// Open a dialog where the user should paste their sign-in token
com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater {
ApplicationManager.getApplication().invokeLater {
val dialog = ContinueAuthDialog() { token ->
// Store the token
handleNewRefreshToken(token)
updateRefreshToken(token)
}
dialog.show()
}
@ -56,7 +59,7 @@ class ContinueAuthService {
setAccountLabel("")
}
private fun handleNewRefreshToken(token: String) {
private fun updateRefreshToken(token: String) {
// Launch a coroutine to call the suspend function
kotlinx.coroutines.GlobalScope.launch {
try {
@ -84,6 +87,20 @@ class ContinueAuthService {
}
}
private fun setupRefreshTokenInterval() {
// Launch a coroutine to refresh the token every 30 minutes
kotlinx.coroutines.GlobalScope.launch {
while (true) {
val refreshToken = getRefreshToken()
if (refreshToken != null) {
updateRefreshToken(refreshToken)
}
kotlinx.coroutines.delay(30 * 60 * 1000)
}
}
}
private suspend fun refreshToken(refreshToken: String) = withContext(Dispatchers.IO) {
val client = OkHttpClient()
val url = URL(CONTROL_PLANE_URL).toURI().resolve("/auth/refresh").toURL()
@ -100,7 +117,7 @@ class ContinueAuthService {
val response = client.newCall(request).execute()
val responseBody = response.body?.string()
val gson = com.google.gson.Gson()
val gson = Gson()
val responseMap = gson.fromJson(responseBody, Map::class.java)
responseMap

View file

@ -4,66 +4,56 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## 0.8.40 - 2024-07-02
Pre-release Changes
### Added
* Support for Llama 3.1 and gpt-4o-mini
### Changed
* Significant improvements to indexing performance
* Improved @codebase quality by more accurately searching over file names and paths
- Support for Gemini 1.5 Pro
- Link to code in the sidebar when using codebase retrieval
- Smoother onboarding experience
- .prompt files, a way of saving and sharing slash commands
- Support for Claude 3.5 Sonnet, Deepseek Coder v2, and other new models
- Support for comments in config.json
- Specify multiple autocomplete models and switch between them
- Improved bracket matching strategy reduces noisy completions
## 0.8.40 - 2024-07-02
### Added
* Support for Gemini 1.5 Pro
* Link to code in the sidebar when using codebase retrieval
* Smoother onboarding experience
* .prompt files, a way of saving and sharing slash commands
* Support for Claude 3.5 Sonnet, Deepseek Coder v2, and other new models
* Support for comments in config.json
* Specify multiple autocomplete models and switch between them
* Improved bracket matching strategy reduces noisy completions
### Fixed
- Numerous reliability upgrades to codebase indexing
* Numerous reliability upgrades to codebase indexing
## 0.8.24 - 2024-04-12
### Added
- Support for improved retrieval models (Voyage embeddings/reranking)
- New @code context provider
- Personal usage analytics
* Support for improved retrieval models (Voyage embeddings/reranking)
* New @code context provider
* Personal usage analytics
## 0.8.15 - 2024-03-05
### Added
- Tab-autocomplete in beta
* Tab-autocomplete in beta
## 0.8.14 - 2024-03-03
### Added
- Image support
- Full-text search index for retrieval
- Docs context provider
- CodeLlama-70b support
* Image support
* Full-text search index for retrieval
* Docs context provider
* CodeLlama-70b support
### Changed
- config.ts only runs in NodeJS, not browser
* config.ts only runs in NodeJS, not browser
### Fixed
- Fixed proxy setting in config.json
* Fixed proxy setting in config.json
## v0.8.2 - 2024-01-23
### Added
- Add codellama and gemini to free trial, using new server
- Local codebase syncing and embeddings using LanceDB
- Improved VS Code theme matching
* Add codellama and gemini to free trial, using new server
* Local codebase syncing and embeddings using LanceDB
* Improved VS Code theme matching
### Changed
- Updates to packaging to download native modules for current platform (lancedb, sqlite, onnxruntime, tree-sitter wasms)
- Context providers now run from the extension side (in Node.js instead of browser javascript)
* Updates to packaging to download native modules for current platform (lancedb, sqlite, onnxruntime, tree-sitter wasms)
* Context providers now run from the extension side (in Node.js instead of browser javascript)
## v0.8.1 - 2024-01-08

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.188",
"version": "0.9.189",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.188",
"version": "0.9.189",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
@ -143,8 +143,9 @@
"tree-sitter-wasms": "^0.1.11",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"web-tree-sitter": "^0.22.0",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"workerpool": "^9.1.3",
"yaml": "^2.4.2",
"zod": "^3.23.8"
},

View file

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

View file

@ -241,11 +241,15 @@ const exe = os === "win32" ? ".exe" : "";
);
});
fs.copyFileSync(
path.join(__dirname, "../../../core/vendor/tree-sitter.wasm"),
path.join(__dirname, "../out/tree-sitter.wasm"),
);
console.log("[info] Copied tree-sitter wasms");
const filesToCopy = [
"../../../core/vendor/tree-sitter.wasm",
"../../../core/llm/llamaTokenizerWorkerPool.mjs",
"../../../core/llm/llamaTokenizer.mjs",
];
for (const f of filesToCopy) {
fs.copyFileSync(path.join(__dirname, f), path.join(__dirname, "..", "out", path.basename(f)));
console.log(`[info] Copied ${path.basename(f)}`);
}
// tree-sitter tag query files
// ncp(
@ -450,6 +454,7 @@ const exe = os === "win32" ? ".exe" : "";
"@esbuild",
"@lancedb",
"@vscode/ripgrep",
"workerpool",
];
fs.mkdirSync("out/node_modules", { recursive: true });

198
gui/package-lock.json generated
View file

@ -62,8 +62,8 @@
"vscode-webview": "^1.0.1-beta.1"
},
"devDependencies": {
"@swc/cli": "^0.3.12",
"@swc/core": "^1.5.25",
"@swc/cli": "^0.3.14",
"@swc/core": "^1.7.2",
"@types/lodash": "^4.17.6",
"@types/node": "^20.5.6",
"@types/node-fetch": "^2.6.4",
@ -72,7 +72,7 @@
"@types/react-router-dom": "^5.3.3",
"@types/react-syntax-highlighter": "^15.5.7",
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react-swc": "^3.0.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.7",
@ -136,8 +136,9 @@
"tree-sitter-wasms": "^0.1.11",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"web-tree-sitter": "^0.22.0",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"workerpool": "^9.1.3",
"yaml": "^2.4.2",
"zod": "^3.23.8"
},
@ -13557,9 +13558,10 @@
"license": "MIT"
},
"node_modules/@swc/cli": {
"version": "0.3.12",
"version": "0.3.14",
"resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.3.14.tgz",
"integrity": "sha512-0vGqD6FSW67PaZUZABkA+ADKsX7OUY/PwNEz1SbQdCvVk/e4Z36Gwh7mFVBQH9RIsMonTyhV1RHkwkGnEfR3zQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@mole-inc/bin-wrapper": "^8.0.1",
"@swc/counter": "^0.1.3",
@ -13601,13 +13603,14 @@
}
},
"node_modules/@swc/core": {
"version": "1.5.25",
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.7.2.tgz",
"integrity": "sha512-mjIlT0e6ygKR8LZ1TjtNrDVMhnB8qpyYAdwexhuVHY255yDdDQCpuPGi20odwnE82QhFBSIWs4HcENDVO/yiMw==",
"dev": true,
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3",
"@swc/types": "^0.1.7"
"@swc/types": "^0.1.12"
},
"engines": {
"node": ">=10"
@ -13617,16 +13620,16 @@
"url": "https://opencollective.com/swc"
},
"optionalDependencies": {
"@swc/core-darwin-arm64": "1.5.25",
"@swc/core-darwin-x64": "1.5.25",
"@swc/core-linux-arm-gnueabihf": "1.5.25",
"@swc/core-linux-arm64-gnu": "1.5.25",
"@swc/core-linux-arm64-musl": "1.5.25",
"@swc/core-linux-x64-gnu": "1.5.25",
"@swc/core-linux-x64-musl": "1.5.25",
"@swc/core-win32-arm64-msvc": "1.5.25",
"@swc/core-win32-ia32-msvc": "1.5.25",
"@swc/core-win32-x64-msvc": "1.5.25"
"@swc/core-darwin-arm64": "1.7.2",
"@swc/core-darwin-x64": "1.7.2",
"@swc/core-linux-arm-gnueabihf": "1.7.2",
"@swc/core-linux-arm64-gnu": "1.7.2",
"@swc/core-linux-arm64-musl": "1.7.2",
"@swc/core-linux-x64-gnu": "1.7.2",
"@swc/core-linux-x64-musl": "1.7.2",
"@swc/core-win32-arm64-msvc": "1.7.2",
"@swc/core-win32-ia32-msvc": "1.7.2",
"@swc/core-win32-x64-msvc": "1.7.2"
},
"peerDependencies": {
"@swc/helpers": "*"
@ -13637,13 +13640,30 @@
}
}
},
"node_modules/@swc/core-darwin-arm64": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.2.tgz",
"integrity": "sha512-Zb8KiGaESzOgh5HBnp6Vhs2fRpngHIT81JOfIo0oaGlzAckamnG7UAXC/yK6cQ8q2KXc78utJ/yq/NM2yVKLqw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-darwin-x64": {
"version": "1.5.25",
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.7.2.tgz",
"integrity": "sha512-qb0HY9GEexpPm46Hb3OY7E6xb4r+eniiThm+0Gcnhf19EZV2ZlsCC8Rdbhmav33x++ZqSDzZ44fxMY2vnN5VDg==",
"cpu": [
"x64"
],
"dev": true,
"license": "Apache-2.0 AND MIT",
"optional": true,
"os": [
"darwin"
@ -13652,15 +13672,144 @@
"node": ">=10"
}
},
"node_modules/@swc/core-linux-arm-gnueabihf": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.2.tgz",
"integrity": "sha512-x2+MOK3RzH3yEkaukKtpDW/udM1x9GoYtXaLNqlq6ovAzZPQ9FDFI0pm1asL4akHUw3s7YTh1aUY7QscstJAHQ==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-arm64-gnu": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.2.tgz",
"integrity": "sha512-4J3HGEDus7a9xnrJUFGyJJgvj4w+BFGiZvs08xbw4Z1ZN4uHJQiJiDsQEAWWciKUxrOndP3SocUq/GhEGiDm0g==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-arm64-musl": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.2.tgz",
"integrity": "sha512-4FhQmYbj8SCmir4pHRLSn8IIFmRKHTL3eZFtOpm26RLME7rXL7Yt33DpzIeTRoHFIesI5NEfaR38WU5mY7P1pA==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-x64-gnu": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.2.tgz",
"integrity": "sha512-Loz10Hy6z5mBIAOe6OInOVsYu+PVxyknCB3thtr7QH+uqEz6dcXhU2ERrO2Lf4dsTsFs/Wb80rv8zTSwB8dpsw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-linux-x64-musl": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.2.tgz",
"integrity": "sha512-8p8qNWaLcTa+qHX4NSv1KNm8BQ6zPoLXuOBo9DtOEqc+K60IISGKPCAS7TJlCcv0q20JnmxZ/cEWW5Qo4TR4XQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-win32-arm64-msvc": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.2.tgz",
"integrity": "sha512-eNWAYOalBlFrhv/IVSQ1dxu7qIGuhxlUJZTYa8jsgLnKt93vAFd2cjLtKZ85k1OibBnq9PkKQyo4NKVr4hBavw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-win32-ia32-msvc": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.2.tgz",
"integrity": "sha512-BbpaCPCnbQHCzpQ9yDH3qp1Y5Ijd0NSMNk4qqESN2WWx0ojV2uBTjPou5NC2MZxk8fM3iJpJ05enf+IeaXuh6A==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/core-win32-x64-msvc": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.2.tgz",
"integrity": "sha512-21mf4Jg9Arx0lUnmRQtYd8IQB4WkY4LHJrvcz3EmKbwCTCXI5rQ6Ifnjk7EmG3Tizv0giHqQBQLu5NXWBz45Mg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=10"
}
},
"node_modules/@swc/counter": {
"version": "0.1.3",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/@swc/types": {
"version": "0.1.7",
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.12.tgz",
"integrity": "sha512-wBJA+SdtkbFhHjTMYH+dEH1y4VpfGdAc2Kw/LK09i9bXd/K6j6PkDcFCEzb6iVfZMkPRrl/q0e3toqTAJdkIVA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3"
}
@ -14253,8 +14402,9 @@
},
"node_modules/@vitejs/plugin-react-swc": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-react-swc/-/plugin-react-swc-3.7.0.tgz",
"integrity": "sha512-yrknSb3Dci6svCd/qhHqhFPDSw0QtjumcqdKMoNNzmOl5lMXTTiqzjWtG4Qask2HdvvzaNgSunbQGet8/GrKdA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@swc/core": "^1.5.7"
},

View file

@ -64,8 +64,8 @@
"vscode-webview": "^1.0.1-beta.1"
},
"devDependencies": {
"@swc/cli": "^0.3.12",
"@swc/core": "^1.5.25",
"@swc/cli": "^0.3.14",
"@swc/core": "^1.7.2",
"@types/lodash": "^4.17.6",
"@types/node": "^20.5.6",
"@types/node-fetch": "^2.6.4",
@ -74,7 +74,7 @@
"@types/react-router-dom": "^5.3.3",
"@types/react-syntax-highlighter": "^15.5.7",
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react-swc": "^3.0.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.7",

View file

@ -6,7 +6,7 @@ import {
TrashIcon,
} from "@heroicons/react/24/outline";
import { ChatHistoryItem } from "core";
import { stripImages } from "core/llm/countTokens";
import { stripImages } from "core/llm/images";
import { useContext, useEffect, useState } from "react";
import { useSelector } from "react-redux";
import styled from "styled-components";

View file

@ -6,7 +6,7 @@ import {
MessagePart,
RangeInFile,
} from "core";
import { stripImages } from "core/llm/countTokens";
import { stripImages } from "core/llm/images";
import { IIdeMessenger } from "../../context/IdeMessenger";
interface MentionAttrs {

View file

@ -12,7 +12,7 @@ import {
SlashCommandDescription,
} from "core";
import { constructMessages } from "core/llm/constructMessages";
import { stripImages } from "core/llm/countTokens";
import { stripImages } from "core/llm/images";
import { getBasename, getRelativePath } from "core/util";
import { usePostHog } from "posthog-js/react";
import { useEffect, useRef } from "react";

View file

@ -2,7 +2,7 @@ import { Dispatch } from "@reduxjs/toolkit";
import { PersistedSessionInfo, SessionInfo } from "core";
import { llmCanGenerateInParallel } from "core/llm/autodetect";
import { stripImages } from "core/llm/countTokens";
import { stripImages } from "core/llm/images";
import { useContext } from "react";
import { useSelector } from "react-redux";
import { IdeMessengerContext } from "../context/IdeMessenger";

View file

@ -20,8 +20,6 @@ const MINISEARCH_OPTIONS = {
const MAX_LENGTH = 70;
function useSubmenuContextProviders() {
// TODO: Refresh periodically
const [minisearches, setMinisearches] = useState<{
[id: string]: MiniSearch;
}>({});
@ -228,6 +226,12 @@ function useSubmenuContextProviders() {
});
}, [contextProviderDescriptions, loaded]);
useWebviewListener("configUpdate", async () => {
// When config is updated (for example switching to a different workspace)
// we need to reload the context providers.
setLoaded(false);
});
return {
getSubmenuContextItems,
addItem,

View file

@ -10,7 +10,7 @@ import {
PromptLog,
} from "core";
import { BrowserSerializedContinueConfig } from "core/config/load";
import { stripImages } from "core/llm/countTokens";
import { stripImages } from "core/llm/images";
import { createSelector } from "reselect";
import { v4 } from "uuid";
import { RootState } from "../store";