Merge branch 'preview'
This commit is contained in:
commit
27fec0f545
79 changed files with 1700 additions and 14316 deletions
|
|
@ -51,7 +51,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
console.log(`Copying ${packageName} to ${toCopy}`);
|
||||
// This is a way to install only one package without npm trying to install all the dependencies
|
||||
// Create a temporary directory for installing the package
|
||||
const adjustedName = packageName.replace(/^@/, "").replace("/", "-");
|
||||
const adjustedName = toCopy.replace(/^@/, "").replace("/", "-");
|
||||
const tempDir = path.join(
|
||||
__dirname,
|
||||
"tmp",
|
||||
|
|
|
|||
2
binary/package-lock.json
generated
2
binary/package-lock.json
generated
|
|
@ -38,7 +38,7 @@
|
|||
},
|
||||
"../core": {
|
||||
"name": "@continuedev/core",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.13",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
|
||||
|
|
|
|||
5916
binary/pnpm-lock.yaml
generated
5916
binary/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
105
core/autocomplete/brackets.ts
Normal file
105
core/autocomplete/brackets.ts
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
* We follow the policy of only completing bracket pairs that we started
|
||||
* But sometimes we started the pair in a previous autocomplete suggestion
|
||||
*/
|
||||
export class BracketMatchingService {
|
||||
private openingBracketsFromLastCompletion: string[] = [];
|
||||
private lastCompletionFile: string | undefined = undefined;
|
||||
|
||||
static BRACKETS: { [key: string]: string } = { "(": ")", "{": "}", "[": "]" };
|
||||
static BRACKETS_REVERSE: { [key: string]: string } = {
|
||||
")": "(",
|
||||
"}": "{",
|
||||
"]": "[",
|
||||
};
|
||||
|
||||
handleAcceptedCompletion(completion: string, filepath: string) {
|
||||
this.openingBracketsFromLastCompletion = [];
|
||||
const stack: string[] = [];
|
||||
|
||||
for (let i = 0; i < completion.length; i++) {
|
||||
const char = completion[i];
|
||||
if (Object.keys(BracketMatchingService.BRACKETS).includes(char)) {
|
||||
// It's an opening bracket
|
||||
stack.push(char);
|
||||
} else if (
|
||||
Object.values(BracketMatchingService.BRACKETS).includes(char)
|
||||
) {
|
||||
// It's a closing bracket
|
||||
if (
|
||||
stack.length === 0 ||
|
||||
BracketMatchingService.BRACKETS[stack.pop()!] !== char
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Any remaining opening brackets in the stack are uncompleted
|
||||
this.openingBracketsFromLastCompletion = stack;
|
||||
this.lastCompletionFile = filepath;
|
||||
}
|
||||
|
||||
async *stopOnUnmatchedClosingBracket(
|
||||
stream: AsyncGenerator<string>,
|
||||
suffix: string,
|
||||
filepath: string,
|
||||
): AsyncGenerator<string> {
|
||||
// Add opening brackets from the previous response
|
||||
let stack: string[] = [];
|
||||
if (this.lastCompletionFile === filepath) {
|
||||
stack = [...this.openingBracketsFromLastCompletion];
|
||||
} else {
|
||||
this.lastCompletionFile = undefined;
|
||||
}
|
||||
|
||||
// Add corresponding open brackets from suffix to stack
|
||||
for (let i = 0; i < suffix.length; i++) {
|
||||
if (suffix[i] === " ") continue;
|
||||
const openBracket = BracketMatchingService.BRACKETS_REVERSE[suffix[i]];
|
||||
if (!openBracket) break;
|
||||
stack.unshift(openBracket);
|
||||
}
|
||||
|
||||
let all = "";
|
||||
let seenNonWhitespaceOrClosingBracket = false;
|
||||
for await (let chunk of stream) {
|
||||
// Allow closing brackets before any non-whitespace characters
|
||||
if (!seenNonWhitespaceOrClosingBracket) {
|
||||
const firstNonWhitespaceOrClosingBracketIndex =
|
||||
chunk.search(/[^\s\)\}\]]/);
|
||||
if (firstNonWhitespaceOrClosingBracketIndex !== -1) {
|
||||
yield chunk.slice(0, firstNonWhitespaceOrClosingBracketIndex);
|
||||
chunk = chunk.slice(firstNonWhitespaceOrClosingBracketIndex);
|
||||
seenNonWhitespaceOrClosingBracket = true;
|
||||
} else {
|
||||
yield chunk;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
all += chunk;
|
||||
const allLines = all.split("\n");
|
||||
for (let i = 0; i < chunk.length; i++) {
|
||||
const char = chunk[i];
|
||||
if (Object.values(BracketMatchingService.BRACKETS).includes(char)) {
|
||||
// It's a closing bracket
|
||||
if (
|
||||
stack.length === 0 ||
|
||||
BracketMatchingService.BRACKETS[stack.pop()!] !== char
|
||||
) {
|
||||
// If the stack is empty or the top of the stack doesn't match the current closing bracket
|
||||
yield chunk.slice(0, i);
|
||||
return; // Stop the generator if the closing bracket doesn't have a matching opening bracket in the stream
|
||||
}
|
||||
} else if (
|
||||
Object.keys(BracketMatchingService.BRACKETS).includes(char)
|
||||
) {
|
||||
// It's an opening bracket
|
||||
stack.push(char);
|
||||
}
|
||||
}
|
||||
yield chunk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,58 +37,3 @@ export async function* noFirstCharNewline(stream: AsyncGenerator<string>) {
|
|||
yield char;
|
||||
}
|
||||
}
|
||||
|
||||
const BRACKETS: { [key: string]: string } = { "(": ")", "{": "}", "[": "]" };
|
||||
const BRACKETS_REVERSE: { [key: string]: string } = {
|
||||
")": "(",
|
||||
"}": "{",
|
||||
"]": "[",
|
||||
};
|
||||
export async function* stopOnUnmatchedClosingBracket(
|
||||
stream: AsyncGenerator<string>,
|
||||
suffix: string,
|
||||
): AsyncGenerator<string> {
|
||||
// Add corresponding open brackets from suffix to stack
|
||||
const stack: string[] = [];
|
||||
for (let i = 0; i < suffix.length; i++) {
|
||||
if (suffix[i] === " ") continue;
|
||||
const openBracket = BRACKETS_REVERSE[suffix[i]];
|
||||
if (!openBracket) break;
|
||||
stack.unshift(openBracket);
|
||||
}
|
||||
|
||||
let all = "";
|
||||
let seenNonWhitespaceOrClosingBracket = false;
|
||||
for await (let chunk of stream) {
|
||||
// Allow closing brackets before any non-whitespace characters
|
||||
if (!seenNonWhitespaceOrClosingBracket) {
|
||||
const firstNonWhitespaceOrClosingBracketIndex =
|
||||
chunk.search(/[^\s\)\}\]]/);
|
||||
if (firstNonWhitespaceOrClosingBracketIndex !== -1) {
|
||||
yield chunk.slice(0, firstNonWhitespaceOrClosingBracketIndex);
|
||||
chunk = chunk.slice(firstNonWhitespaceOrClosingBracketIndex);
|
||||
seenNonWhitespaceOrClosingBracket = true;
|
||||
} else {
|
||||
yield chunk;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
all += chunk;
|
||||
for (let i = 0; i < chunk.length; i++) {
|
||||
const char = chunk[i];
|
||||
if (Object.values(BRACKETS).includes(char)) {
|
||||
// It's a closing bracket
|
||||
if (stack.length === 0 || BRACKETS[stack.pop()!] !== char) {
|
||||
// If the stack is empty or the top of the stack doesn't match the current closing bracket
|
||||
yield chunk.slice(0, i);
|
||||
return; // Stop the generator if the closing bracket doesn't have a matching opening bracket in the stream
|
||||
}
|
||||
} else if (Object.keys(BRACKETS).includes(char)) {
|
||||
// It's an opening bracket
|
||||
stack.push(char);
|
||||
}
|
||||
}
|
||||
yield chunk;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import path from "path";
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import { RangeInFileWithContents } from "../commands/util.js";
|
||||
import { ConfigHandler } from "../config/handler.js";
|
||||
import { TRIAL_FIM_MODEL } from "../config/onboarding.js";
|
||||
import { streamLines } from "../diff/util.js";
|
||||
import {
|
||||
IDE,
|
||||
|
|
@ -22,11 +23,11 @@ import {
|
|||
} from "../util/parameters.js";
|
||||
import { Telemetry } from "../util/posthog.js";
|
||||
import { getRangeInString } from "../util/ranges.js";
|
||||
import { BracketMatchingService } from "./brackets.js";
|
||||
import AutocompleteLruCache from "./cache.js";
|
||||
import {
|
||||
noFirstCharNewline,
|
||||
onlyWhitespaceAfterEndOfLine,
|
||||
stopOnUnmatchedClosingBracket,
|
||||
} from "./charStream.js";
|
||||
import {
|
||||
constructAutocompletePrompt,
|
||||
|
|
@ -138,6 +139,7 @@ export async function getTabCompletion(
|
|||
generatorReuseManager: GeneratorReuseManager,
|
||||
input: AutocompleteInput,
|
||||
getDefinitionsFromLsp: GetLspDefinitionsFunction,
|
||||
bracketMatchingService: BracketMatchingService,
|
||||
): Promise<AutocompleteOutcome | undefined> {
|
||||
const startTime = Date.now();
|
||||
|
||||
|
|
@ -171,11 +173,9 @@ export async function getTabCompletion(
|
|||
llm.useLegacyCompletionsEndpoint = true;
|
||||
} else if (
|
||||
llm.providerName === "free-trial" &&
|
||||
llm.model !== "starcoder-7b"
|
||||
llm.model !== TRIAL_FIM_MODEL
|
||||
) {
|
||||
throw new Error(
|
||||
"The only free trial model supported for tab-autocomplete is starcoder-7b.",
|
||||
);
|
||||
llm.model = TRIAL_FIM_MODEL;
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
@ -320,6 +320,7 @@ export async function getTabCompletion(
|
|||
];
|
||||
|
||||
const multiline =
|
||||
!input.selectedCompletionInfo && // Only ever single-line if using intellisense selected value
|
||||
options.multilineCompletions !== "never" &&
|
||||
(options.multilineCompletions === "always" || completeMultiline);
|
||||
|
||||
|
|
@ -327,11 +328,16 @@ export async function getTabCompletion(
|
|||
const generator = generatorReuseManager.getGenerator(
|
||||
prefix,
|
||||
() =>
|
||||
llm.streamComplete(prompt, {
|
||||
...completionOptions,
|
||||
raw: true,
|
||||
stop,
|
||||
}),
|
||||
llm.supportsFim()
|
||||
? llm.streamFim(prefix, suffix, {
|
||||
...completionOptions,
|
||||
stop,
|
||||
})
|
||||
: llm.streamComplete(prompt, {
|
||||
...completionOptions,
|
||||
raw: true,
|
||||
stop,
|
||||
}),
|
||||
multiline,
|
||||
);
|
||||
|
||||
|
|
@ -349,7 +355,11 @@ export async function getTabCompletion(
|
|||
let charGenerator = generatorWithCancellation();
|
||||
charGenerator = noFirstCharNewline(charGenerator);
|
||||
charGenerator = onlyWhitespaceAfterEndOfLine(charGenerator, lang.endOfLine);
|
||||
charGenerator = stopOnUnmatchedClosingBracket(charGenerator, suffix);
|
||||
charGenerator = bracketMatchingService.stopOnUnmatchedClosingBracket(
|
||||
charGenerator,
|
||||
suffix,
|
||||
filepath,
|
||||
);
|
||||
|
||||
let lineGenerator = streamLines(charGenerator);
|
||||
lineGenerator = stopAtLines(lineGenerator);
|
||||
|
|
@ -382,6 +392,14 @@ export async function getTabCompletion(
|
|||
|
||||
// Post-processing
|
||||
completion = completion.trimEnd();
|
||||
if (llm.model.includes("codestral")) {
|
||||
// Codestral sometimes starts with an extra space
|
||||
if (completion[0] === " " && completion[1] !== " ") {
|
||||
if (suffix.startsWith("\n")) {
|
||||
completion = completion.slice(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const time = Date.now() - startTime;
|
||||
|
|
@ -418,6 +436,7 @@ export class CompletionProvider {
|
|||
private generatorReuseManager: GeneratorReuseManager;
|
||||
private autocompleteCache = AutocompleteLruCache.get();
|
||||
public errorsShown: Set<string> = new Set();
|
||||
private bracketMatchingService = new BracketMatchingService();
|
||||
|
||||
private onError(e: any) {
|
||||
console.warn("Error generating autocompletion: ", e);
|
||||
|
|
@ -464,6 +483,11 @@ export class CompletionProvider {
|
|||
cacheHit: outcome.cacheHit,
|
||||
});
|
||||
this._outcomes.delete(completionId);
|
||||
|
||||
this.bracketMatchingService.handleAcceptedCompletion(
|
||||
outcome.completion,
|
||||
outcome.filepath,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -577,6 +601,7 @@ export class CompletionProvider {
|
|||
this.generatorReuseManager,
|
||||
input,
|
||||
this.getDefinitionsFromLsp,
|
||||
this.bracketMatchingService,
|
||||
);
|
||||
|
||||
if (!outcome?.completion) {
|
||||
|
|
|
|||
|
|
@ -64,19 +64,23 @@ export async function* stopAtSimilarLine(
|
|||
stream: LineStream,
|
||||
line: string,
|
||||
): AsyncGenerator<string> {
|
||||
line = line.trim();
|
||||
const lineIsBracketEnding = isBracketEnding(line);
|
||||
const trimmedLine = line.trim();
|
||||
const lineIsBracketEnding = isBracketEnding(trimmedLine);
|
||||
for await (const nextLine of stream) {
|
||||
if (lineIsBracketEnding && line.trim() === nextLine.trim()) {
|
||||
if (nextLine === line) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (lineIsBracketEnding && trimmedLine.trim() === nextLine.trim()) {
|
||||
yield nextLine;
|
||||
continue;
|
||||
}
|
||||
|
||||
let lineQualifies = nextLine.length > 4 && line.length > 4;
|
||||
let lineQualifies = nextLine.length > 4 && trimmedLine.length > 4;
|
||||
if (
|
||||
lineQualifies &&
|
||||
(commonPrefixLength(nextLine.trim(), line.trim()) > 8 ||
|
||||
distance(nextLine.trim(), line) / line.length < 0.1)
|
||||
(commonPrefixLength(nextLine.trim(), trimmedLine.trim()) > 8 ||
|
||||
distance(nextLine.trim(), trimmedLine) / trimmedLine.length < 0.1)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,39 @@
|
|||
import {
|
||||
ContextProviderWithParams,
|
||||
ModelDescription,
|
||||
SerializedContinueConfig,
|
||||
SlashCommandDescription,
|
||||
} from "../index.js";
|
||||
|
||||
export const FREE_TRIAL_MODELS: ModelDescription[] = [
|
||||
{
|
||||
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: "Llama3 70b (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "llama3-70b",
|
||||
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: "Codestral (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "codestral",
|
||||
},
|
||||
{
|
||||
title: "Claude 3 Sonnet (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "claude-3-sonnet-20240229",
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultConfig: SerializedContinueConfig = {
|
||||
models: [
|
||||
{
|
||||
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: "Llama3 70b (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "llama3-70b",
|
||||
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: "Claude 3 Sonnet (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "claude-3-sonnet-20240229",
|
||||
},
|
||||
],
|
||||
models: FREE_TRIAL_MODELS,
|
||||
customCommands: [
|
||||
{
|
||||
name: "test",
|
||||
|
|
@ -41,27 +50,7 @@ export const defaultConfig: SerializedContinueConfig = {
|
|||
};
|
||||
|
||||
export const defaultConfigJetBrains: SerializedContinueConfig = {
|
||||
models: [
|
||||
{
|
||||
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: "Llama3 70b (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "llama3-70b",
|
||||
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: "Claude 3 Sonnet (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "claude-3-sonnet-20240229",
|
||||
},
|
||||
],
|
||||
models: FREE_TRIAL_MODELS,
|
||||
customCommands: [
|
||||
{
|
||||
name: "test",
|
||||
|
|
@ -77,7 +66,7 @@ export const defaultConfigJetBrains: SerializedContinueConfig = {
|
|||
},
|
||||
};
|
||||
|
||||
export const defaultSlashCommandsVscode = [
|
||||
export const defaultSlashCommandsVscode: SlashCommandDescription[] = [
|
||||
{
|
||||
name: "edit",
|
||||
description: "Edit selected code",
|
||||
|
|
@ -94,6 +83,10 @@ export const defaultSlashCommandsVscode = [
|
|||
name: "cmd",
|
||||
description: "Generate a shell command",
|
||||
},
|
||||
{
|
||||
name: "commit",
|
||||
description: "Generate a git commit message",
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultSlashCommandsJetBrains = [
|
||||
|
|
@ -109,6 +102,10 @@ export const defaultSlashCommandsJetBrains = [
|
|||
name: "share",
|
||||
description: "Export the current chat session to markdown",
|
||||
},
|
||||
{
|
||||
name: "commit",
|
||||
description: "Generate a git commit message",
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultContextProvidersVsCode: ContextProviderWithParams[] = [
|
||||
|
|
|
|||
|
|
@ -19,12 +19,10 @@ export class ConfigHandler {
|
|||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly writeLog: (text: string) => Promise<void>,
|
||||
private readonly onConfigUpdate: () => void,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.writeLog = writeLog;
|
||||
this.onConfigUpdate = onConfigUpdate;
|
||||
try {
|
||||
this.loadConfig();
|
||||
} catch (e) {
|
||||
|
|
@ -37,11 +35,18 @@ export class ConfigHandler {
|
|||
this.reloadConfig();
|
||||
}
|
||||
|
||||
private updateListeners: (() => void)[] = [];
|
||||
onConfigUpdate(listener: () => void) {
|
||||
this.updateListeners.push(listener);
|
||||
}
|
||||
|
||||
reloadConfig() {
|
||||
this.savedConfig = undefined;
|
||||
this.savedBrowserConfig = undefined;
|
||||
this.loadConfig();
|
||||
this.onConfigUpdate();
|
||||
for (const listener of this.updateListeners) {
|
||||
listener();
|
||||
}
|
||||
}
|
||||
|
||||
async getSerializedConfig(): Promise<BrowserSerializedContinueConfig> {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import TransformersJsEmbeddingsProvider from "../indexing/embeddings/Transformer
|
|||
import { AllEmbeddingsProviders } from "../indexing/embeddings/index.js";
|
||||
import { BaseLLM } from "../llm/index.js";
|
||||
import CustomLLMClass from "../llm/llms/CustomLLM.js";
|
||||
import FreeTrial from "../llm/llms/FreeTrial.js";
|
||||
import { llmFromDescription } from "../llm/llms/index.js";
|
||||
import { IdeSettings } from "../protocol/ideWebview.js";
|
||||
import { fetchwithRequestOptions } from "../util/fetchWithOptions.js";
|
||||
|
|
@ -277,6 +278,17 @@ async function intermediateToFinalConfig(
|
|||
};
|
||||
}
|
||||
|
||||
// Obtain auth token (only if free trial being used)
|
||||
const freeTrialModels = models.filter(
|
||||
(model) => model.providerName === "free-trial",
|
||||
);
|
||||
if (freeTrialModels.length > 0) {
|
||||
const ghAuthToken = await ide.getGitHubAuthToken();
|
||||
for (const model of freeTrialModels) {
|
||||
(model as FreeTrial).setupGhAuthToken(ghAuthToken);
|
||||
}
|
||||
}
|
||||
|
||||
// Tab autocomplete model
|
||||
let autocompleteLlm: BaseLLM | undefined = undefined;
|
||||
if (config.tabAutocompleteModel) {
|
||||
|
|
@ -290,6 +302,11 @@ async function intermediateToFinalConfig(
|
|||
config.completionOptions,
|
||||
config.systemMessage,
|
||||
);
|
||||
|
||||
if (autocompleteLlm?.providerName === "free-trial") {
|
||||
const ghAuthToken = await ide.getGitHubAuthToken();
|
||||
(autocompleteLlm as FreeTrial).setupGhAuthToken(ghAuthToken);
|
||||
}
|
||||
} else {
|
||||
autocompleteLlm = new CustomLLMClass(config.tabAutocompleteModel);
|
||||
}
|
||||
|
|
@ -382,7 +399,7 @@ function finalToBrowserConfig(
|
|||
completionOptions: m.completionOptions,
|
||||
systemMessage: m.systemMessage,
|
||||
requestOptions: m.requestOptions,
|
||||
promptTemplates: m.promptTemplates,
|
||||
promptTemplates: m.promptTemplates as any,
|
||||
})),
|
||||
systemMessage: final.systemMessage,
|
||||
completionOptions: final.completionOptions,
|
||||
|
|
|
|||
|
|
@ -1,35 +1,18 @@
|
|||
import { SerializedContinueConfig } from "../index.js";
|
||||
import { FREE_TRIAL_MODELS } from "./default.js";
|
||||
|
||||
export function setupOptimizedMode(
|
||||
export const TRIAL_FIM_MODEL = "codestral-latest";
|
||||
|
||||
export function setupApiKeysMode(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
...config,
|
||||
models: [
|
||||
{
|
||||
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: "Llama3 70b (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "llama3-70b",
|
||||
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: "Claude 3 Sonnet (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "claude-3-sonnet-20240229",
|
||||
},
|
||||
],
|
||||
models: config.models.filter((model) => model.provider !== "free-trial"),
|
||||
tabAutocompleteModel: {
|
||||
title: "Tab Autocomplete",
|
||||
provider: "free-trial",
|
||||
model: "starcoder-7b",
|
||||
model: TRIAL_FIM_MODEL,
|
||||
},
|
||||
embeddingsProvider: {
|
||||
provider: "free-trial",
|
||||
|
|
@ -48,7 +31,7 @@ export function setupOptimizedExistingUserMode(
|
|||
tabAutocompleteModel: {
|
||||
title: "Tab Autocomplete",
|
||||
provider: "free-trial",
|
||||
model: "starcoder-7b",
|
||||
model: TRIAL_FIM_MODEL,
|
||||
},
|
||||
embeddingsProvider: {
|
||||
provider: "free-trial",
|
||||
|
|
@ -89,6 +72,29 @@ export function setupLocalMode(
|
|||
};
|
||||
}
|
||||
|
||||
export function setupFreeTrialMode(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
...config,
|
||||
models: [
|
||||
...FREE_TRIAL_MODELS,
|
||||
...config.models.filter((model) => model.provider !== "free-trial"),
|
||||
],
|
||||
tabAutocompleteModel: {
|
||||
title: "Tab Autocomplete",
|
||||
provider: "free-trial",
|
||||
model: TRIAL_FIM_MODEL,
|
||||
},
|
||||
embeddingsProvider: {
|
||||
provider: "free-trial",
|
||||
},
|
||||
reranker: {
|
||||
name: "free-trial",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function setupLocalAfterFreeTrial(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import {
|
|||
import { CodeSnippetsCodebaseIndex } from "../../indexing/CodeSnippetsIndex.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
|
||||
const MAX_SUBMENU_ITEMS = 10_000;
|
||||
|
||||
class CodeContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "code",
|
||||
|
|
@ -29,13 +31,15 @@ class CodeContextProvider extends BaseContextProvider {
|
|||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
// TODO: Dynamically load submenu items based on the query
|
||||
// instead of loading everything into memory
|
||||
const tags = await args.ide.getTags("codeSnippets");
|
||||
const snippets = await Promise.all(
|
||||
tags.map((tag) => CodeSnippetsCodebaseIndex.getAll(tag)),
|
||||
);
|
||||
|
||||
const submenuItems: ContextSubmenuItem[] = [];
|
||||
for (const snippetList of snippets) {
|
||||
for (const snippetList of snippets.slice(-MAX_SUBMENU_ITEMS)) {
|
||||
submenuItems.push(...snippetList);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import {
|
|||
import { getBasename, getLastNPathParts } from "../../util/index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
|
||||
const MAX_SUBMENU_ITEMS = 10_000;
|
||||
|
||||
class FileContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "file",
|
||||
|
|
@ -41,7 +43,7 @@ class FileContextProvider extends BaseContextProvider {
|
|||
return args.ide.listWorkspaceContents(dir);
|
||||
}),
|
||||
);
|
||||
const files = results.flat();
|
||||
const files = results.flat().slice(-MAX_SUBMENU_ITEMS);
|
||||
return files.map((file) => {
|
||||
return {
|
||||
id: file,
|
||||
|
|
|
|||
52
core/core.ts
52
core/core.ts
|
|
@ -3,16 +3,18 @@ import { ContextItemId, IDE } from ".";
|
|||
import { CompletionProvider } from "./autocomplete/completionProvider";
|
||||
import { ConfigHandler } from "./config/handler";
|
||||
import {
|
||||
setupApiKeysMode,
|
||||
setupFreeTrialMode,
|
||||
setupLocalAfterFreeTrial,
|
||||
setupLocalMode,
|
||||
setupOptimizedExistingUserMode,
|
||||
setupOptimizedMode,
|
||||
} from "./config/onboarding";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client";
|
||||
import { indexDocs } from "./indexing/docs";
|
||||
import TransformersJsEmbeddingsProvider from "./indexing/embeddings/TransformersJsEmbeddingsProvider";
|
||||
import { CodebaseIndexer, PauseToken } from "./indexing/indexCodebase";
|
||||
import Ollama from "./llm/llms/Ollama";
|
||||
import { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import { logDevData } from "./util/devdata";
|
||||
|
|
@ -23,6 +25,7 @@ import type { IMessenger, Message } from "./util/messenger";
|
|||
import { editConfigJson, getConfigJsonPath } from "./util/paths";
|
||||
import { Telemetry } from "./util/posthog";
|
||||
import { streamDiffLines } from "./util/verticalEdit";
|
||||
import { IndexingProgressUpdate } from ".";
|
||||
|
||||
export class Core {
|
||||
// implements IMessenger<ToCoreProtocol, FromCoreProtocol>
|
||||
|
|
@ -30,6 +33,7 @@ export class Core {
|
|||
codebaseIndexerPromise: Promise<CodebaseIndexer>;
|
||||
completionProvider: CompletionProvider;
|
||||
continueServerClientPromise: Promise<ContinueServerClient>;
|
||||
indexingState: IndexingProgressUpdate
|
||||
|
||||
private abortedMessageIds: Set<string> = new Set();
|
||||
|
||||
|
|
@ -55,12 +59,16 @@ export class Core {
|
|||
constructor(
|
||||
private readonly messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
private readonly ide: IDE,
|
||||
private readonly onWrite: (text: string) => Promise<void> = async () => {},
|
||||
) {
|
||||
this.indexingState = { status:"loading", desc: 'loading', progress: 0 }
|
||||
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettingsPromise,
|
||||
async (text: string) => {},
|
||||
this.onWrite,
|
||||
);
|
||||
this.configHandler.onConfigUpdate(
|
||||
(() => this.messenger.send("configUpdate", undefined)).bind(this),
|
||||
);
|
||||
|
||||
|
|
@ -353,7 +361,15 @@ export class Core {
|
|||
const model =
|
||||
config.models.find((model) => model.title === msg.data.title) ??
|
||||
config.models.find((model) => model.title?.startsWith(msg.data.title));
|
||||
return model?.listModels();
|
||||
if (model) {
|
||||
return model.listModels();
|
||||
} else {
|
||||
if (msg.data.title === "Ollama") {
|
||||
return new Ollama({ model: "" }).listModels();
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function* runNodeJsSlashCommand(
|
||||
|
|
@ -469,15 +485,27 @@ export class Core {
|
|||
editConfigJson(
|
||||
mode === "local"
|
||||
? setupLocalMode
|
||||
: mode === "localAfterFreeTrial"
|
||||
? setupLocalAfterFreeTrial
|
||||
: mode === "optimized"
|
||||
? setupOptimizedMode
|
||||
: setupOptimizedExistingUserMode,
|
||||
: mode === "freeTrial"
|
||||
? setupFreeTrialMode
|
||||
: mode === "localAfterFreeTrial"
|
||||
? setupLocalAfterFreeTrial
|
||||
: mode === "apiKeys"
|
||||
? setupApiKeysMode
|
||||
: setupOptimizedExistingUserMode,
|
||||
);
|
||||
this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("addAutocompleteModel", (msg) => {
|
||||
editConfigJson((config) => {
|
||||
return {
|
||||
...config,
|
||||
tabAutocompleteModel: msg.data.model,
|
||||
};
|
||||
});
|
||||
this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("stats/getTokensPerDay", async (msg) => {
|
||||
const rows = await DevDataSqliteDb.getTokensPerDay();
|
||||
return rows;
|
||||
|
|
@ -494,6 +522,13 @@ export class Core {
|
|||
new GlobalContext().update("indexingPaused", msg.data);
|
||||
indexingPauseToken.paused = msg.data;
|
||||
});
|
||||
on("index/indexingProgressBarInitialized", async (msg) => {
|
||||
// Triggered when progress bar is initialized.
|
||||
// If a non-default state has been stored, update the indexing display to that state
|
||||
if (this.indexingState.status != 'loading') {
|
||||
this.messenger.request("indexProgress", this.indexingState);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private indexingCancellationController: AbortController | undefined;
|
||||
|
|
@ -508,6 +543,7 @@ export class Core {
|
|||
this.indexingCancellationController.signal,
|
||||
)) {
|
||||
this.messenger.request("indexProgress", update);
|
||||
this.indexingState = update
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
core/index.d.ts
vendored
22
core/index.d.ts
vendored
|
|
@ -37,7 +37,7 @@ export interface Chunk extends ChunkWithoutID {
|
|||
export interface IndexingProgressUpdate {
|
||||
progress: number;
|
||||
desc: string;
|
||||
status: "starting" | "indexing" | "done" | "failed" | "paused" | "disabled";
|
||||
status: "loading" | "indexing" | "done" | "failed" | "paused" | "disabled";
|
||||
}
|
||||
|
||||
export type PromptTemplate =
|
||||
|
|
@ -58,7 +58,7 @@ export interface ILLM extends LLMOptions {
|
|||
contextLength: number;
|
||||
completionOptions: CompletionOptions;
|
||||
requestOptions?: RequestOptions;
|
||||
promptTemplates?: Record<string, string>;
|
||||
promptTemplates?: Record<string, PromptTemplate>;
|
||||
templateMessages?: (messages: ChatMessage[]) => string;
|
||||
writeLog?: (str: string) => Promise<void>;
|
||||
llmRequestHook?: (model: string, prompt: string) => any;
|
||||
|
|
@ -78,6 +78,12 @@ export interface ILLM extends LLMOptions {
|
|||
options?: LLMFullCompletionOptions,
|
||||
): AsyncGenerator<string, PromptLog>;
|
||||
|
||||
streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
options?: LLMFullCompletionOptions,
|
||||
): AsyncGenerator<string, PromptLog>;
|
||||
|
||||
streamChat(
|
||||
messages: ChatMessage[],
|
||||
options?: LLMFullCompletionOptions,
|
||||
|
|
@ -96,6 +102,8 @@ export interface ILLM extends LLMOptions {
|
|||
|
||||
supportsPrefill(): boolean;
|
||||
|
||||
supportsFim(): boolean;
|
||||
|
||||
listModels(): Promise<string[]>;
|
||||
|
||||
renderPromptTemplate(
|
||||
|
|
@ -287,7 +295,7 @@ export interface LLMOptions {
|
|||
completionOptions?: CompletionOptions;
|
||||
requestOptions?: RequestOptions;
|
||||
template?: TemplateType;
|
||||
promptTemplates?: Record<string, string>;
|
||||
promptTemplates?: Record<string, PromptTemplate>;
|
||||
templateMessages?: (messages: ChatMessage[]) => string;
|
||||
writeLog?: (str: string) => Promise<void>;
|
||||
llmRequestHook?: (model: string, prompt: string) => any;
|
||||
|
|
@ -430,6 +438,7 @@ export interface IDE {
|
|||
getGitRootPath(dir: string): Promise<string | undefined>;
|
||||
listDir(dir: string): Promise<[string, FileType][]>;
|
||||
getLastModified(files: string[]): Promise<{ [path: string]: number }>;
|
||||
getGitHubAuthToken(): Promise<string | undefined>;
|
||||
}
|
||||
|
||||
// Slash Commands
|
||||
|
|
@ -529,6 +538,7 @@ type ModelProvider =
|
|||
| "flowise"
|
||||
| "groq"
|
||||
| "continue-proxy"
|
||||
| "fireworks"
|
||||
| "custom";
|
||||
|
||||
export type ModelName =
|
||||
|
|
@ -544,6 +554,12 @@ export type ModelName =
|
|||
| "gpt-4-turbo-preview"
|
||||
| "gpt-4-vision-preview"
|
||||
// Mistral
|
||||
| "codestral-latest"
|
||||
| "open-mistral-7b"
|
||||
| "open-mixtral-8x7b"
|
||||
| "open-mixtral-8x22b"
|
||||
| "mistral-small-latest"
|
||||
| "mistral-large-latest"
|
||||
| "mistral-7b"
|
||||
| "mistral-8x7b"
|
||||
// Llama 2
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
|
||||
// Compute
|
||||
let table: Table<number[]> | undefined = undefined;
|
||||
let needToCreateTable = true;
|
||||
const existingTables = await db.tableNames();
|
||||
let needToCreateTable = !existingTables.includes(tableName);
|
||||
|
||||
const addComputedLanceDbRows = async (
|
||||
pathAndCacheKey: PathAndCacheKey,
|
||||
|
|
|
|||
|
|
@ -241,6 +241,11 @@ const configs: SiteIndexingConfig[] = [
|
|||
startUrl: "https://alpinejs.dev/start-here",
|
||||
rootUrl: "https://alpinejs.dev/",
|
||||
},
|
||||
{
|
||||
title: "C# Language Reference",
|
||||
startUrl: "https://learn.microsoft.com/en-us/dotnet/csharp/",
|
||||
rootUrl: "https://learn.microsoft.com/en-us/dotnet/csharp/",
|
||||
},
|
||||
];
|
||||
|
||||
export default configs;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,14 @@ class EmbeddingsPipeline {
|
|||
|
||||
env.allowLocalModels = true;
|
||||
env.allowRemoteModels = false;
|
||||
env.localModelPath = path.join(__dirname, "..", "models");
|
||||
env.localModelPath = path.join(
|
||||
typeof __dirname === "undefined"
|
||||
? // @ts-ignore
|
||||
path.dirname(new URL(import.meta.url).pathname)
|
||||
: __dirname,
|
||||
"..",
|
||||
"models",
|
||||
);
|
||||
|
||||
EmbeddingsPipeline.instance = await pipeline(
|
||||
EmbeddingsPipeline.task,
|
||||
|
|
|
|||
|
|
@ -56,16 +56,16 @@ export class CodebaseIndexer {
|
|||
yield {
|
||||
progress: 0,
|
||||
desc: "Nothing to index",
|
||||
status: "disabled",
|
||||
status: "disabled",
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const config = await this.configHandler.loadConfig();
|
||||
if (config.disableIndexing) {
|
||||
yield {
|
||||
progress: 0,
|
||||
desc: "Indexing is disabled in the config.json",
|
||||
desc: "Indexing is disabled in config.json",
|
||||
status: "disabled",
|
||||
};
|
||||
return;
|
||||
|
|
@ -73,7 +73,7 @@ export class CodebaseIndexer {
|
|||
yield {
|
||||
progress: 0,
|
||||
desc: "Starting indexing",
|
||||
status: "starting",
|
||||
status: "loading",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ export class CodebaseIndexer {
|
|||
yield {
|
||||
progress: 0,
|
||||
desc: "Starting indexing...",
|
||||
status: "starting",
|
||||
status: "loading",
|
||||
};
|
||||
|
||||
for (const directory of workspaceDirs) {
|
||||
|
|
@ -161,9 +161,15 @@ export class CodebaseIndexer {
|
|||
status: "indexing",
|
||||
};
|
||||
} catch (e) {
|
||||
yield {
|
||||
progress: 0,
|
||||
desc: `${e}`,
|
||||
status: "failed"
|
||||
}
|
||||
console.warn(
|
||||
`Error updating the ${codebaseIndex.artifactId} index: ${e}`,
|
||||
);
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ const PROVIDER_HANDLES_TEMPLATING: ModelProvider[] = [
|
|||
"anthropic",
|
||||
"bedrock",
|
||||
"continue-proxy",
|
||||
"mistral",
|
||||
];
|
||||
|
||||
const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ export abstract class BaseLLM implements ILLM {
|
|||
return (this.constructor as typeof BaseLLM).providerName;
|
||||
}
|
||||
|
||||
supportsFim(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
supportsImages(): boolean {
|
||||
return modelSupportsImages(this.providerName, this.model, this.title);
|
||||
}
|
||||
|
|
@ -55,21 +59,23 @@ export abstract class BaseLLM implements ILLM {
|
|||
if (this.providerName === "openai") {
|
||||
if (
|
||||
this.apiBase?.includes("api.groq.com") ||
|
||||
this.apiBase?.includes("api.mistral.ai") ||
|
||||
this.apiBase?.includes(":1337") ||
|
||||
this._llmOptions.useLegacyCompletionsEndpoint?.valueOf() === false
|
||||
) {
|
||||
// Jan + Groq don't support completions : (
|
||||
// Jan + Groq + Mistral don't support completions : (
|
||||
// Seems to be going out of style...
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.providerName === "groq") {
|
||||
if (["groq", "mistral"].includes(this.providerName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
supportsPrefill(): boolean {
|
||||
return ["ollama", "anthropic"].includes(this.providerName);
|
||||
return ["ollama", "anthropic", "mistral"].includes(this.providerName);
|
||||
}
|
||||
|
||||
uniqueId: string;
|
||||
|
|
@ -81,7 +87,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
completionOptions: CompletionOptions;
|
||||
requestOptions?: RequestOptions;
|
||||
template?: TemplateType;
|
||||
promptTemplates?: Record<string, string>;
|
||||
promptTemplates?: Record<string, PromptTemplate>;
|
||||
templateMessages?: (messages: ChatMessage[]) => string;
|
||||
writeLog?: (str: string) => Promise<void>;
|
||||
llmRequestHook?: (model: string, prompt: string) => any;
|
||||
|
|
@ -322,6 +328,60 @@ ${prompt}`;
|
|||
return formatted;
|
||||
}
|
||||
|
||||
async *_streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string, PromptLog> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async *streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
options: LLMFullCompletionOptions = {},
|
||||
): AsyncGenerator<string> {
|
||||
const { completionOptions, log } = this._parseCompletionOptions(options);
|
||||
|
||||
const madeUpFimPrompt = `${prefix}<FIM>${suffix}`;
|
||||
if (log) {
|
||||
if (this.writeLog) {
|
||||
await this.writeLog(
|
||||
this._compileLogMessage(madeUpFimPrompt, completionOptions),
|
||||
);
|
||||
}
|
||||
if (this.llmRequestHook) {
|
||||
this.llmRequestHook(completionOptions.model, madeUpFimPrompt);
|
||||
}
|
||||
}
|
||||
|
||||
let completion = "";
|
||||
for await (const chunk of this._streamFim(
|
||||
prefix,
|
||||
suffix,
|
||||
completionOptions,
|
||||
)) {
|
||||
completion += chunk;
|
||||
yield chunk;
|
||||
}
|
||||
|
||||
this._logTokensGenerated(
|
||||
completionOptions.model,
|
||||
madeUpFimPrompt,
|
||||
completion,
|
||||
);
|
||||
|
||||
if (log && this.writeLog) {
|
||||
await this.writeLog(`Completion:\n\n${completion}\n\n`);
|
||||
}
|
||||
|
||||
return {
|
||||
prompt: madeUpFimPrompt,
|
||||
completion,
|
||||
completionOptions,
|
||||
};
|
||||
}
|
||||
|
||||
async *streamComplete(
|
||||
_prompt: string,
|
||||
options: LLMFullCompletionOptions = {},
|
||||
|
|
|
|||
18
core/llm/llms/Fireworks.ts
Normal file
18
core/llm/llms/Fireworks.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { LLMOptions, ModelProvider } from "../../index.js";
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class Fireworks extends OpenAI {
|
||||
static providerName: ModelProvider = "fireworks";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.fireworks.ai/inference/v1",
|
||||
};
|
||||
|
||||
private static modelConversion: { [key: string]: string } = {
|
||||
"starcoder-7b": "accounts/fireworks/models/starcoder-7b",
|
||||
};
|
||||
protected _convertModelName(model: string): string {
|
||||
return Fireworks.modelConversion[model] ?? model;
|
||||
}
|
||||
}
|
||||
|
||||
export default Fireworks;
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { TRIAL_FIM_MODEL } from "../../config/onboarding.js";
|
||||
import { getHeaders } from "../../continueServer/stubs/headers.js";
|
||||
import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js";
|
||||
import { SERVER_URL } from "../../util/parameters.js";
|
||||
|
|
@ -8,9 +9,21 @@ import { streamResponse } from "../stream.js";
|
|||
class FreeTrial extends BaseLLM {
|
||||
static providerName: ModelProvider = "free-trial";
|
||||
|
||||
private ghAuthToken: string | undefined = undefined;
|
||||
|
||||
setupGhAuthToken(ghAuthToken: string | undefined) {
|
||||
this.ghAuthToken = ghAuthToken;
|
||||
}
|
||||
|
||||
private async _getHeaders() {
|
||||
if (!this.ghAuthToken) {
|
||||
throw new Error(
|
||||
"Please sign in with GitHub in order to use the free trial. If you'd like to use Continue without signing in, you can set up your own local model or API key.",
|
||||
);
|
||||
}
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${this.ghAuthToken}`,
|
||||
...(await getHeaders()),
|
||||
};
|
||||
}
|
||||
|
|
@ -37,7 +50,7 @@ class FreeTrial extends BaseLLM {
|
|||
presence_penalty: options.presencePenalty,
|
||||
max_tokens: options.maxTokens,
|
||||
stop:
|
||||
options.model === "starcoder-7b"
|
||||
options.model === TRIAL_FIM_MODEL
|
||||
? options.stop
|
||||
: options.stop?.slice(0, 2),
|
||||
temperature: options.temperature,
|
||||
|
|
@ -120,8 +133,37 @@ class FreeTrial extends BaseLLM {
|
|||
this._countTokens(completion, args.model, false);
|
||||
}
|
||||
|
||||
supportsFim(): boolean {
|
||||
return this.model === "codestral-latest";
|
||||
}
|
||||
|
||||
async *_streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
const args = this._convertArgs(this.collectArgs(options));
|
||||
const resp = await this.fetch(`${SERVER_URL}/stream_fim`, {
|
||||
method: "POST",
|
||||
headers: await this._getHeaders(),
|
||||
body: JSON.stringify({
|
||||
prefix,
|
||||
suffix,
|
||||
...args,
|
||||
}),
|
||||
});
|
||||
|
||||
let completion = "";
|
||||
for await (const value of streamResponse(resp)) {
|
||||
yield value;
|
||||
completion += value;
|
||||
}
|
||||
this._countTokens(completion, args.model, false);
|
||||
}
|
||||
|
||||
async listModels(): Promise<string[]> {
|
||||
return [
|
||||
"codestral-latest",
|
||||
"llama3-70b",
|
||||
"gpt-4o",
|
||||
"gpt-3.5-turbo",
|
||||
|
|
|
|||
|
|
@ -1,12 +1,76 @@
|
|||
import { LLMOptions, ModelProvider } from "../../index.js";
|
||||
import {
|
||||
ChatMessage,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
ModelProvider,
|
||||
} from "../../index.js";
|
||||
import { streamSse } from "../stream.js";
|
||||
import { gptEditPrompt } from "../templates/edit.js";
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class Mistral extends OpenAI {
|
||||
static providerName: ModelProvider = "mistral";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.mistral.ai/v1/",
|
||||
model: "mistral-small",
|
||||
model: "codestral-latest",
|
||||
promptTemplates: {
|
||||
edit: gptEditPrompt,
|
||||
},
|
||||
};
|
||||
|
||||
private static modelConversion: { [key: string]: string } = {
|
||||
"mistral-7b": "open-mistral-7b",
|
||||
"mistral-8x7b": "open-mixtral-8x7b",
|
||||
};
|
||||
protected _convertModelName(model: string): string {
|
||||
return Mistral.modelConversion[model] ?? model;
|
||||
}
|
||||
|
||||
protected _convertArgs(options: any, messages: ChatMessage[]) {
|
||||
const finalOptions = super._convertArgs(options, messages);
|
||||
|
||||
const lastMessage = finalOptions.messages[finalOptions.messages.length - 1];
|
||||
if (lastMessage.role === "assistant") {
|
||||
(lastMessage as any).prefix = true;
|
||||
}
|
||||
|
||||
return finalOptions;
|
||||
}
|
||||
|
||||
supportsFim(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
async *_streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
const endpoint = new URL("fim/completions", this.apiBase);
|
||||
const resp = await this.fetch(endpoint, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
model: options.model,
|
||||
prompt: prefix,
|
||||
suffix,
|
||||
max_tokens: options.maxTokens,
|
||||
temperature: options.temperature,
|
||||
top_p: options.topP,
|
||||
frequency_penalty: options.frequencyPenalty,
|
||||
presence_penalty: options.presencePenalty,
|
||||
stop: options.stop,
|
||||
stream: true,
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"x-api-key": this.apiKey ?? "",
|
||||
},
|
||||
});
|
||||
for await (const chunk of streamSse(resp)) {
|
||||
yield chunk.choices[0].delta.content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Mistral;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import type {
|
||||
ChatMessage,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
ModelProvider,
|
||||
|
|
@ -29,16 +28,10 @@ class Together extends OpenAI {
|
|||
"wizardcoder-34b": "WizardLM/WizardCoder-Python-34B-V1.0",
|
||||
};
|
||||
|
||||
private _getModelName(model: string) {
|
||||
protected _convertModelName(model: string) {
|
||||
return Together.MODEL_IDS[model] || this.model;
|
||||
}
|
||||
|
||||
protected _convertArgs(options: any, messages: ChatMessage[]) {
|
||||
const finalOptions = super._convertArgs(options, messages);
|
||||
finalOptions.model = this._getModelName(options.model);
|
||||
return finalOptions;
|
||||
}
|
||||
|
||||
protected async *_streamComplete(
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import Anthropic from "./Anthropic.js";
|
|||
import Bedrock from "./Bedrock.js";
|
||||
import Cohere from "./Cohere.js";
|
||||
import DeepInfra from "./DeepInfra.js";
|
||||
import Fireworks from "./Fireworks.js";
|
||||
import Flowise from "./Flowise.js";
|
||||
import FreeTrial from "./FreeTrial.js";
|
||||
import Gemini from "./Gemini.js";
|
||||
|
|
@ -96,6 +97,7 @@ const LLMs = [
|
|||
DeepInfra,
|
||||
Flowise,
|
||||
Groq,
|
||||
Fireworks,
|
||||
ContinueProxy,
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/core",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.13",
|
||||
"description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js server. It is written in TypeScript and contains much of the functionality that was previously inside of the legacy Continue Python Server.",
|
||||
"scripts": {
|
||||
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest ./test/diff.test.ts",
|
||||
|
|
|
|||
7734
core/pnpm-lock.yaml
generated
7734
core/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -6,6 +6,7 @@ import {
|
|||
DiffLine,
|
||||
LLMFullCompletionOptions,
|
||||
MessageContent,
|
||||
ModelDescription,
|
||||
PersistedSessionInfo,
|
||||
RangeInFile,
|
||||
SerializedContinueConfig,
|
||||
|
|
@ -120,16 +121,19 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
];
|
||||
"index/setPaused": [boolean, void];
|
||||
"index/forceReIndex": [undefined | string, void];
|
||||
"index/indexingProgressBarInitialized": [undefined, void];
|
||||
completeOnboarding: [
|
||||
{
|
||||
mode:
|
||||
| "local"
|
||||
| "optimized"
|
||||
| "apiKeys"
|
||||
| "custom"
|
||||
| "freeTrial"
|
||||
| "localExistingUser"
|
||||
| "optimizedExistingUser"
|
||||
| "localAfterFreeTrial";
|
||||
},
|
||||
void,
|
||||
];
|
||||
addAutocompleteModel: [{ model: ModelDescription }, void];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,4 +69,6 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
getGitRootPath: [{ dir: string }, string | undefined];
|
||||
listDir: [{ dir: string }, [string, FileType][]];
|
||||
getLastModified: [{ files: string[] }, { [path: string]: number }];
|
||||
|
||||
getGitHubAuthToken: [undefined, string | undefined];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
|
|||
insertAtCursor: [{ text: string }, void];
|
||||
copyText: [{ text: string }, void];
|
||||
"jetbrains/editorInsetHeight": [{ height: number }, void];
|
||||
setGitHubAuthToken: [{ token: string }, void];
|
||||
};
|
||||
|
||||
export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
|
||||
|
|
@ -64,4 +65,5 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
|
|||
addApiKey: [undefined, void];
|
||||
setupLocalModel: [undefined, void];
|
||||
incrementFtc: [undefined, void];
|
||||
openOnboarding: [undefined, void];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
|
|||
"stats/getTokensPerModel",
|
||||
"index/setPaused",
|
||||
"index/forceReIndex",
|
||||
"index/indexingProgressBarInitialized",
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel",
|
||||
];
|
||||
|
||||
// Message types to pass through from core to webview
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import fs from "node:fs";
|
||||
import { getGlobalContextFilePath } from "./paths";
|
||||
import { IndexingProgressUpdate } from "..";
|
||||
|
||||
export type GlobalContextType = {
|
||||
indexingPaused: boolean;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import {
|
|||
import { getContinueGlobalPath } from "./paths.js";
|
||||
|
||||
class FileSystemIde implements IDE {
|
||||
async getGitHubAuthToken(): Promise<string | undefined> {
|
||||
return undefined;
|
||||
}
|
||||
getLastModified(files: string[]): Promise<{ [path: string]: number }> {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
|
|
@ -31,8 +34,8 @@ class FileSystemIde implements IDE {
|
|||
dirent.isDirectory()
|
||||
? FileType.Directory
|
||||
: dirent.isSymbolicLink()
|
||||
? FileType.SymbolicLink
|
||||
: FileType.File,
|
||||
? FileType.SymbolicLink
|
||||
: FileType.File,
|
||||
]);
|
||||
return Promise.resolve(all);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ export class MessageIde implements IDE {
|
|||
data: ToIdeFromWebviewOrCoreProtocol[T][0],
|
||||
) => Promise<ToIdeFromWebviewOrCoreProtocol[T][1]>,
|
||||
) {}
|
||||
getGitHubAuthToken(): Promise<string | undefined> {
|
||||
return this.request("getGitHubAuthToken", undefined);
|
||||
}
|
||||
getLastModified(files: string[]): Promise<{ [path: string]: number }> {
|
||||
return this.request("getLastModified", { files });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ You likely want to use a model that is 30B+ parameters for chat.
|
|||
|
||||
### Open-source LLMs
|
||||
|
||||
*We currently recommend the following open-source models:*
|
||||
_We currently recommend the following open-source models:_
|
||||
|
||||
#### Llama 3 from Meta
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ You likely want to use a model that is 30B+ parameters for chat.
|
|||
- Unlimited GPU: `deepseek-coder-33b`
|
||||
- Limited GPU: `deepseek-coder-6.7b`
|
||||
|
||||
*You can also use other open-source chat models by adding them to your `config.json`.*
|
||||
_You can also use other open-source chat models by adding them to your `config.json`._
|
||||
|
||||
### Commercial LLMs
|
||||
|
||||
|
|
@ -45,15 +45,21 @@ You likely want to use a model that is 30B+ parameters for chat.
|
|||
- Unlimited budget: `gemini-pro-1.5-latest`
|
||||
- Limited budget: `gemini-pro-1.0`
|
||||
|
||||
*You can also use other commercial chat models by adding them to your `config.json`.*
|
||||
_You can also use other commercial chat models by adding them to your `config.json`._
|
||||
|
||||
## Autocomplete
|
||||
|
||||
You likely want to use a model that is 1-15B parameters for autocomplete.
|
||||
|
||||
### Commercial LLMs
|
||||
|
||||
#### Codestral from Mistral
|
||||
|
||||
Our current recommendation for autocomplete, if you are able to choose any model, is `codestral-latest` from Mistral's API.
|
||||
|
||||
### Open-source LLMs
|
||||
|
||||
*We currently recommend the following open-source models:*
|
||||
_We currently recommend the following open-source models:_
|
||||
|
||||
#### DeepSeek Coder from DeepSeek
|
||||
|
||||
|
|
@ -65,7 +71,7 @@ You likely want to use a model that is 1-15B parameters for autocomplete.
|
|||
- Unlimited GPU: `starcoder-2-7b`
|
||||
- Limited GPU: `starcoder-2-3b`
|
||||
|
||||
*You can also use other autocomplete models by adding them to your `config.json`.*
|
||||
_You can also use other autocomplete models by adding them to your `config.json`._
|
||||
|
||||
## Embeddings
|
||||
|
||||
|
|
@ -80,8 +86,6 @@ You likely want to use an embeddings model that is made to vectorize code.
|
|||
|
||||
- `voyage-code-2`
|
||||
|
||||
|
||||
|
||||
*You can also use other embeddings models by adding them to your `config.json`.*
|
||||
_You can also use other embeddings models by adding them to your `config.json`._
|
||||
|
||||
**In addition to selecting models, you will need to figure out [what providers to use](./select-provider.md).**
|
||||
|
|
|
|||
40
docs/docs/walkthroughs/set-up-codestral.md
Normal file
40
docs/docs/walkthroughs/set-up-codestral.md
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: How to set up Codestral
|
||||
description: How to set up Codestral
|
||||
keywords: [codestral, mistral, model setup]
|
||||
---
|
||||
|
||||
# How to set up Codestral with Continue
|
||||
|
||||

|
||||
|
||||
**Here is a step-by-step guide on how to set up Codestral with Continue using the Mistral AI API:**
|
||||
|
||||
1. Install the Continue VS Code or JetBrains extension following the instructions [here](../quickstart.md)
|
||||
|
||||
2. Click on the gear icon in the bottom right corner of the Continue window to open `~/.continue/config.json` (MacOS) / `%userprofile%\.continue\config.json` (Windows)
|
||||
|
||||
3. Log in and create an API key on Mistral AI's La Plateforme [here](https://console.mistral.ai/api-keys/)
|
||||
|
||||
4. To use Codestral as your model for both `autocomplete` and `chat`, replace `[API_KEY]` with your Mistral API key below and add it to your `config.json` file:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Codestral",
|
||||
"provider": "mistral"
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "[API_KEY]",
|
||||
}
|
||||
],
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest"
|
||||
"apiKey": "[API_KEY]",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
5. If you run into any issues or have any questions, please join our Discord and post in the `#help` channel [here](https://discord.gg/EfJEfdFnDQ)
|
||||
|
|
@ -2,17 +2,16 @@
|
|||
|
||||
Continue now provides support for tab autocomplete in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains IDEs](https://plugins.jetbrains.com/plugin/22707-continue/edit). We will be greatly improving the experience over the next few releases, and it is always helpful to hear feedback. If you have any problems or suggestions, please let us know in our [Discord](https://discord.gg/vapESyrFmJ).
|
||||
|
||||
## Setting up with Starcoder 7b (recommended)
|
||||
## Setting up with Codestral (recommended)
|
||||
|
||||
If you want to have the best autocomplete experience, we recommend using Starcoder 7b, which is available through [Fireworks AI](https://fireworks.ai/models/fireworks/starcoder-7b). To do this, obtain an API key and add it to your `config.json`:
|
||||
If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your `config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Starcoder 7b",
|
||||
"provider": "openai",
|
||||
"model": "accounts/fireworks/models/starcoder-7b",
|
||||
"apiBase": "https://api.fireworks.ai/inference/v1",
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const sidebars = {
|
|||
collapsed: true,
|
||||
items: [
|
||||
// "walkthroughs/codellama",
|
||||
"walkthroughs/set-up-codestral",
|
||||
"walkthroughs/running-continue-without-internet",
|
||||
"walkthroughs/codebase-embeddings",
|
||||
"walkthroughs/tab-autocomplete",
|
||||
|
|
|
|||
BIN
docs/static/img/mistral-x-continue.png
vendored
Normal file
BIN
docs/static/img/mistral-x-continue.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
22
docs/static/schemas/config.json
vendored
22
docs/static/schemas/config.json
vendored
|
|
@ -149,6 +149,7 @@
|
|||
"deepinfra",
|
||||
"flowise",
|
||||
"groq",
|
||||
"fireworks",
|
||||
"continue-proxy"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
|
|
@ -439,6 +440,7 @@
|
|||
"model": {
|
||||
"enum": [
|
||||
"gpt-4o",
|
||||
"codestral-latest",
|
||||
"llama3-70b",
|
||||
"gpt-3.5-turbo",
|
||||
"phind-codellama-34b",
|
||||
|
|
@ -446,7 +448,6 @@
|
|||
"mistral-8x7b",
|
||||
"claude-3-sonnet-20240229",
|
||||
"claude-3-haiku-20240307",
|
||||
"starcoder-7b",
|
||||
"AUTODETECT"
|
||||
]
|
||||
}
|
||||
|
|
@ -790,11 +791,11 @@
|
|||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"codestral-latest",
|
||||
"open-mistral-7b",
|
||||
"open-mixtral-8x7b",
|
||||
"open-mixtral-8x22b",
|
||||
"mistral-small-latest",
|
||||
"mistral-medium-latest",
|
||||
"mistral-large-latest"
|
||||
]
|
||||
}
|
||||
|
|
@ -825,6 +826,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["fireworks"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["starcoder-7b"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension
|
|||
pluginName = continue-intellij-extension
|
||||
pluginRepositoryUrl = https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion = 0.0.47
|
||||
pluginVersion = 0.0.48
|
||||
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild = 223
|
||||
|
|
|
|||
|
|
@ -141,7 +141,9 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC
|
|||
"getGitRootPath",
|
||||
"getLastModified",
|
||||
"insertAtCursor",
|
||||
"applyToFile"
|
||||
"applyToFile",
|
||||
"getGitHubAuthToken",
|
||||
"setGitHubAuthToken",
|
||||
)
|
||||
|
||||
private val PASS_THROUGH_TO_WEBVIEW = listOf<String>(
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.intellij.openapi.application.ReadAction
|
|||
import com.intellij.openapi.application.WriteAction
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.SelectionModel
|
||||
|
|
@ -53,6 +54,66 @@ fun uuid(): String {
|
|||
return UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
val DEFAULT_IGNORE_FILETYPES = arrayOf(
|
||||
".DS_Store",
|
||||
"-lock.json",
|
||||
".lock",
|
||||
".log",
|
||||
".ttf",
|
||||
".png",
|
||||
".jpg",
|
||||
".jpeg",
|
||||
".gif",
|
||||
".mp4",
|
||||
".svg",
|
||||
".ico",
|
||||
".pdf",
|
||||
".zip",
|
||||
".gz",
|
||||
".tar",
|
||||
".dmg",
|
||||
".tgz",
|
||||
".rar",
|
||||
".7z",
|
||||
".exe",
|
||||
".dll",
|
||||
".obj",
|
||||
".o",
|
||||
".o.d",
|
||||
".a",
|
||||
".lib",
|
||||
".so",
|
||||
".dylib",
|
||||
".ncb",
|
||||
".sdf",
|
||||
".woff",
|
||||
".woff2",
|
||||
".eot",
|
||||
".cur",
|
||||
".avi",
|
||||
".mpg",
|
||||
".mpeg",
|
||||
".mov",
|
||||
".mp3",
|
||||
".mp4",
|
||||
".mkv",
|
||||
".mkv",
|
||||
".webm",
|
||||
".jar",
|
||||
".onnx",
|
||||
".parquet",
|
||||
".pqt",
|
||||
".wav",
|
||||
".webp",
|
||||
".db",
|
||||
".sqlite",
|
||||
".wasm",
|
||||
".plist",
|
||||
".profraw",
|
||||
".gcda",
|
||||
".gcno",
|
||||
"go.sum",
|
||||
)
|
||||
|
||||
data class IdeMessage<T>(val type: String, val messageId: String, val message: T)
|
||||
data class Position(val line: Int, val character: Int)
|
||||
|
|
@ -523,6 +584,29 @@ class IdeProtocolClient (
|
|||
}
|
||||
"applyToFile" -> {
|
||||
}
|
||||
"getGitHubAuthToken" -> {
|
||||
val continueSettingsService = service<ContinueExtensionSettings>()
|
||||
val ghAuthToken = continueSettingsService.continueState.ghAuthToken;
|
||||
|
||||
if (ghAuthToken == null) {
|
||||
// Open a dialog so user can enter their GitHub token
|
||||
continuePluginService.sendToWebview("openOnboarding", null, uuid())
|
||||
respond(null)
|
||||
} else {
|
||||
respond(ghAuthToken)
|
||||
}
|
||||
}
|
||||
"setGitHubAuthToken" -> {
|
||||
val continueSettingsService = service<ContinueExtensionSettings>()
|
||||
val data = data as Map<String, String>
|
||||
continueSettingsService.continueState.ghAuthToken = data["token"]
|
||||
respond(null)
|
||||
}
|
||||
"openUrl" -> {
|
||||
val url = data as String
|
||||
java.awt.Desktop.getDesktop().browse(java.net.URI(url))
|
||||
respond(null)
|
||||
}
|
||||
else -> {
|
||||
println("Unknown messageType: $messageType")
|
||||
}
|
||||
|
|
@ -732,6 +816,8 @@ class IdeProtocolClient (
|
|||
"__pycache__",
|
||||
"site-packages",
|
||||
".gradle",
|
||||
".cache",
|
||||
"gems",
|
||||
)
|
||||
private fun shouldIgnoreDirectory(name: String): Boolean {
|
||||
val components = File(name).path.split(File.separator)
|
||||
|
|
@ -757,19 +843,30 @@ class IdeProtocolClient (
|
|||
|
||||
val contents = ArrayList<String>()
|
||||
for (dir in dirs) {
|
||||
if (DEFAULT_IGNORE_DIRS.any { dir.contains(it) }) {
|
||||
continue
|
||||
}
|
||||
|
||||
val workspacePath = File(dir)
|
||||
val workspaceDir = VirtualFileManager.getInstance().findFileByUrl("file://$workspacePath")
|
||||
|
||||
if (workspaceDir != null) {
|
||||
VfsUtil.iterateChildrenRecursively(workspaceDir, null) { virtualFile: VirtualFile ->
|
||||
if (virtualFile.isDirectory) {
|
||||
// if (shouldIgnoreDirectory(virtualFile.name)) {
|
||||
//
|
||||
// }
|
||||
if (shouldIgnoreDirectory(virtualFile.name)) {
|
||||
// Don't recurse into this particular directory
|
||||
return@iterateChildrenRecursively false
|
||||
}
|
||||
} else {
|
||||
val filePath = virtualFile.path
|
||||
if (!shouldIgnoreDirectory(filePath)) {
|
||||
if (!shouldIgnoreDirectory(filePath) && !DEFAULT_IGNORE_FILETYPES.any { filePath.endsWith(it) }) {
|
||||
contents.add(filePath)
|
||||
|
||||
// Set a hard limit on the number of files to list
|
||||
if (contents.size > 10000) {
|
||||
// Completely exit the iteration
|
||||
return@iterateChildrenRecursively false
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ open class ContinueExtensionSettings : PersistentStateComponent<ContinueExtensio
|
|||
var remoteConfigSyncPeriod: Int = 60
|
||||
var userToken: String? = null
|
||||
var enableTabAutocomplete: Boolean = false
|
||||
var ghAuthToken: String? = null
|
||||
}
|
||||
|
||||
var continueState: ContinueState = ContinueState()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ class ContinueBrowser(val project: Project, url: String, useOsr: Boolean = false
|
|||
"stats/getTokensPerModel",
|
||||
"index/setPaused",
|
||||
"index/forceReIndex",
|
||||
"completeOnboarding"
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel"
|
||||
)
|
||||
|
||||
private fun registerAppSchemeHandler() {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@
|
|||
"deepinfra",
|
||||
"flowise",
|
||||
"groq",
|
||||
"fireworks",
|
||||
"continue-proxy"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
|
|
@ -439,6 +440,7 @@
|
|||
"model": {
|
||||
"enum": [
|
||||
"gpt-4o",
|
||||
"codestral-latest",
|
||||
"llama3-70b",
|
||||
"gpt-3.5-turbo",
|
||||
"phind-codellama-34b",
|
||||
|
|
@ -446,7 +448,6 @@
|
|||
"mistral-8x7b",
|
||||
"claude-3-sonnet-20240229",
|
||||
"claude-3-haiku-20240307",
|
||||
"starcoder-7b",
|
||||
"AUTODETECT"
|
||||
]
|
||||
}
|
||||
|
|
@ -790,11 +791,11 @@
|
|||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"codestral-latest",
|
||||
"open-mistral-7b",
|
||||
"open-mixtral-8x7b",
|
||||
"open-mixtral-8x22b",
|
||||
"mistral-small-latest",
|
||||
"mistral-medium-latest",
|
||||
"mistral-large-latest"
|
||||
]
|
||||
}
|
||||
|
|
@ -825,6 +826,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["fireworks"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["starcoder-7b"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@
|
|||
"deepinfra",
|
||||
"flowise",
|
||||
"groq",
|
||||
"fireworks",
|
||||
"continue-proxy"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
|
|
@ -439,6 +440,7 @@
|
|||
"model": {
|
||||
"enum": [
|
||||
"gpt-4o",
|
||||
"codestral-latest",
|
||||
"llama3-70b",
|
||||
"gpt-3.5-turbo",
|
||||
"phind-codellama-34b",
|
||||
|
|
@ -446,7 +448,6 @@
|
|||
"mistral-8x7b",
|
||||
"claude-3-sonnet-20240229",
|
||||
"claude-3-haiku-20240307",
|
||||
"starcoder-7b",
|
||||
"AUTODETECT"
|
||||
]
|
||||
}
|
||||
|
|
@ -790,11 +791,11 @@
|
|||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"codestral-latest",
|
||||
"open-mistral-7b",
|
||||
"open-mixtral-8x7b",
|
||||
"open-mixtral-8x22b",
|
||||
"mistral-small-latest",
|
||||
"mistral-medium-latest",
|
||||
"mistral-large-latest"
|
||||
]
|
||||
}
|
||||
|
|
@ -825,6 +826,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["fireworks"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["starcoder-7b"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@
|
|||
"deepinfra",
|
||||
"flowise",
|
||||
"groq",
|
||||
"fireworks",
|
||||
"continue-proxy"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
|
|
@ -475,6 +476,7 @@
|
|||
"model": {
|
||||
"enum": [
|
||||
"gpt-4o",
|
||||
"codestral-latest",
|
||||
"llama3-70b",
|
||||
"gpt-3.5-turbo",
|
||||
"phind-codellama-34b",
|
||||
|
|
@ -482,7 +484,6 @@
|
|||
"mistral-8x7b",
|
||||
"claude-3-sonnet-20240229",
|
||||
"claude-3-haiku-20240307",
|
||||
"starcoder-7b",
|
||||
"AUTODETECT"
|
||||
]
|
||||
}
|
||||
|
|
@ -867,11 +868,11 @@
|
|||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"codestral-latest",
|
||||
"open-mistral-7b",
|
||||
"open-mixtral-8x7b",
|
||||
"open-mixtral-8x22b",
|
||||
"mistral-small-latest",
|
||||
"mistral-medium-latest",
|
||||
"mistral-large-latest"
|
||||
]
|
||||
}
|
||||
|
|
@ -906,6 +907,29 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": [
|
||||
"fireworks"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"provider"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"starcoder-7b"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
|
|||
2
extensions/vscode/package-lock.json
generated
2
extensions/vscode/package-lock.json
generated
|
|
@ -88,7 +88,7 @@
|
|||
},
|
||||
"../../core": {
|
||||
"name": "@continuedev/core",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.13",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
"homepage": "https://continue.dev",
|
||||
"qna": "https://github.com/continuedev/continue/issues/new/choose",
|
||||
"license": "Apache-2.0",
|
||||
"displayName": "Continue - Llama 3, GPT-4, and more",
|
||||
"displayName": "Continue - Codestral, GPT-4o, and more",
|
||||
"pricing": "Free",
|
||||
"description": "Open-source autopilot - build your own AI software development system",
|
||||
"publisher": "Continue",
|
||||
|
|
@ -40,10 +40,11 @@
|
|||
"chatgpt",
|
||||
"github",
|
||||
"copilot",
|
||||
"llama",
|
||||
"3",
|
||||
"mistral",
|
||||
"codestral",
|
||||
"codegpt",
|
||||
"ai"
|
||||
"ai",
|
||||
"llama"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onStartupFinished",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ rimrafSync(path.join(__dirname, "..", "out"));
|
|||
fs.mkdirSync(path.join(__dirname, "..", "out", "node_modules"), {
|
||||
recursive: true,
|
||||
});
|
||||
const guiDist = path.join(__dirname, "..", "..", "..", "gui", "dist");
|
||||
if (!fs.existsSync(guiDist)) {
|
||||
fs.mkdirSync(guiDist, { recursive: true });
|
||||
}
|
||||
|
||||
// Get the target to package for
|
||||
let target = undefined;
|
||||
|
|
@ -316,7 +320,7 @@ const exe = os === "win32" ? ".exe" : "";
|
|||
console.log(`Copying ${packageName} to ${toCopy}`);
|
||||
// This is a way to install only one package without npm trying to install all the dependencies
|
||||
// Create a temporary directory for installing the package
|
||||
const adjustedName = packageName.replace(/^@/, "").replace("/", "-");
|
||||
const adjustedName = toCopy.replace(/^@/, "").replace("/", "-");
|
||||
|
||||
const tempDir = `/tmp/continue-node_modules-${adjustedName}`;
|
||||
const currentDir = process.cwd();
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@ export const vscodeExtensionPromise: Promise<VsCodeExtension> = new Promise(
|
|||
(resolve) => (resolveVsCodeExtension = resolve),
|
||||
);
|
||||
|
||||
let resolveVsCodeExtension = (_: VsCodeExtension): void => {};
|
||||
export const vscodeExtensionPromise: Promise<VsCodeExtension> = new Promise(
|
||||
(resolve) => (resolveVsCodeExtension = resolve),
|
||||
);
|
||||
|
||||
export async function activateExtension(context: vscode.ExtensionContext) {
|
||||
// Add necessary files
|
||||
getTsConfigPath();
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
export async function setupAuth() {
|
||||
const session = await vscode.authentication.getSession("github", [], {
|
||||
createIfNone: true,
|
||||
});
|
||||
return session;
|
||||
}
|
||||
|
||||
export class ManualTokenAuthProvider implements vscode.AuthenticationProvider {
|
||||
constructor(
|
||||
public onDidChangeSessions: vscode.Event<vscode.AuthenticationProviderAuthenticationSessionsChangeEvent>,
|
||||
private readonly context: vscode.ExtensionContext,
|
||||
) {}
|
||||
|
||||
getSessions(
|
||||
scopes?: readonly string[] | undefined,
|
||||
): Thenable<readonly vscode.AuthenticationSession[]> {
|
||||
const sessions = this.context.globalState.get<
|
||||
vscode.AuthenticationSession[]
|
||||
>("continue.manualTokenSessions");
|
||||
return Promise.resolve(
|
||||
sessions?.filter((session) => {
|
||||
if (!scopes) {
|
||||
return true;
|
||||
}
|
||||
return !scopes.some((scope) => session.scopes.indexOf(scope) === -1);
|
||||
}) ?? [],
|
||||
);
|
||||
}
|
||||
async createSession(
|
||||
scopes: readonly string[],
|
||||
): Promise<vscode.AuthenticationSession> {
|
||||
const token = await vscode.window.showInputBox({
|
||||
prompt: "Enter your Continue user token",
|
||||
ignoreFocusOut: true,
|
||||
});
|
||||
|
||||
if (!token) {
|
||||
throw new Error("User canceled");
|
||||
}
|
||||
|
||||
const session: vscode.AuthenticationSession = {
|
||||
id: uuidv4(),
|
||||
accessToken: token,
|
||||
account: {
|
||||
id: token,
|
||||
label: token,
|
||||
},
|
||||
scopes: [],
|
||||
};
|
||||
return session;
|
||||
}
|
||||
removeSession(sessionId: string): Thenable<void> {
|
||||
return this.context.globalState.update(
|
||||
"continue.manualTokenSessions",
|
||||
(sessions: vscode.AuthenticationSession[] | undefined) =>
|
||||
sessions?.filter((session) => session.id !== sessionId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -478,9 +478,6 @@ const commandsMap: (
|
|||
panel.webview.html = sidebar.getSidebarContent(
|
||||
extensionContext,
|
||||
panel,
|
||||
ide,
|
||||
configHandler,
|
||||
verticalDiffManager,
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { FileEdit, IDE } from "core";
|
||||
import type { FileEdit } from "core";
|
||||
import type { ConfigHandler } from "core/config/handler";
|
||||
import * as vscode from "vscode";
|
||||
import type { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager";
|
||||
import { getTheme } from "./util/getTheme";
|
||||
import { getExtensionVersion } from "./util/util";
|
||||
import { getExtensionUri, getNonce, getUniqueId } from "./util/vscode";
|
||||
|
|
@ -22,9 +21,6 @@ export class ContinueGUIWebviewViewProvider
|
|||
webviewView.webview.html = this.getSidebarContent(
|
||||
this.extensionContext,
|
||||
webviewView,
|
||||
this.ide,
|
||||
this.configHandler,
|
||||
this.verticalDiffManager,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -50,21 +46,21 @@ export class ContinueGUIWebviewViewProvider
|
|||
}
|
||||
|
||||
constructor(
|
||||
private readonly configHandler: ConfigHandler,
|
||||
private readonly ide: IDE,
|
||||
private readonly configHandlerPromise: Promise<ConfigHandler>,
|
||||
private readonly windowId: string,
|
||||
private readonly extensionContext: vscode.ExtensionContext,
|
||||
private readonly verticalDiffManager: VerticalPerLineDiffManager,
|
||||
) {
|
||||
this.webviewProtocol = new VsCodeWebviewProtocol();
|
||||
this.webviewProtocol = new VsCodeWebviewProtocol(
|
||||
(async () => {
|
||||
const configHandler = await this.configHandlerPromise;
|
||||
return configHandler.reloadConfig();
|
||||
}).bind(this),
|
||||
);
|
||||
}
|
||||
|
||||
getSidebarContent(
|
||||
context: vscode.ExtensionContext | undefined,
|
||||
panel: vscode.WebviewPanel | vscode.WebviewView,
|
||||
ide: IDE,
|
||||
configHandler: ConfigHandler,
|
||||
verticalDiffManager: VerticalPerLineDiffManager,
|
||||
page: string | undefined = undefined,
|
||||
edits: FileEdit[] | undefined = undefined,
|
||||
isFullScreen = false,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export class VsCodeMessenger {
|
|||
>,
|
||||
private readonly webviewProtocol: VsCodeWebviewProtocol,
|
||||
private readonly ide: VsCodeIde,
|
||||
private readonly verticalDiffManager: VerticalPerLineDiffManager,
|
||||
private readonly verticalDiffManagerPromise: Promise<VerticalPerLineDiffManager>,
|
||||
) {
|
||||
/** WEBVIEW ONLY LISTENERS **/
|
||||
this.onWebview("showFile", (msg) => {
|
||||
|
|
@ -134,7 +134,7 @@ export class VsCodeMessenger {
|
|||
editor.selection = new vscode.Selection(start, end);
|
||||
}
|
||||
|
||||
this.verticalDiffManager.streamEdit(
|
||||
(await this.verticalDiffManagerPromise).streamEdit(
|
||||
`The following code was suggested as an edit:\n\`\`\`\n${msg.data.text}\n\`\`\`\nPlease apply it to the previous code.`,
|
||||
await this.webviewProtocol.request("getDefaultModelTitle", undefined),
|
||||
);
|
||||
|
|
@ -201,72 +201,72 @@ export class VsCodeMessenger {
|
|||
return ide.getIdeSettings();
|
||||
});
|
||||
this.onWebviewOrCore("getDiff", async (msg) => {
|
||||
return await ide.getDiff();
|
||||
return ide.getDiff();
|
||||
});
|
||||
this.onWebviewOrCore("getTerminalContents", async (msg) => {
|
||||
return await ide.getTerminalContents();
|
||||
return ide.getTerminalContents();
|
||||
});
|
||||
this.onWebviewOrCore("getDebugLocals", async (msg) => {
|
||||
return await ide.getDebugLocals(Number(msg.data.threadIndex));
|
||||
return ide.getDebugLocals(Number(msg.data.threadIndex));
|
||||
});
|
||||
this.onWebviewOrCore("getAvailableThreads", async (msg) => {
|
||||
return await ide.getAvailableThreads();
|
||||
return ide.getAvailableThreads();
|
||||
});
|
||||
this.onWebviewOrCore("getTopLevelCallStackSources", async (msg) => {
|
||||
return await ide.getTopLevelCallStackSources(
|
||||
return ide.getTopLevelCallStackSources(
|
||||
msg.data.threadIndex,
|
||||
msg.data.stackDepth,
|
||||
);
|
||||
});
|
||||
this.onWebviewOrCore("listWorkspaceContents", async (msg) => {
|
||||
return await ide.listWorkspaceContents();
|
||||
return ide.listWorkspaceContents();
|
||||
});
|
||||
this.onWebviewOrCore("getWorkspaceDirs", async (msg) => {
|
||||
return await ide.getWorkspaceDirs();
|
||||
return ide.getWorkspaceDirs();
|
||||
});
|
||||
this.onWebviewOrCore("listFolders", async (msg) => {
|
||||
return await ide.listFolders();
|
||||
return ide.listFolders();
|
||||
});
|
||||
this.onWebviewOrCore("writeFile", async (msg) => {
|
||||
return await ide.writeFile(msg.data.path, msg.data.contents);
|
||||
return ide.writeFile(msg.data.path, msg.data.contents);
|
||||
});
|
||||
this.onWebviewOrCore("showVirtualFile", async (msg) => {
|
||||
return await ide.showVirtualFile(msg.data.name, msg.data.content);
|
||||
return ide.showVirtualFile(msg.data.name, msg.data.content);
|
||||
});
|
||||
this.onWebviewOrCore("getContinueDir", async (msg) => {
|
||||
return await ide.getContinueDir();
|
||||
return ide.getContinueDir();
|
||||
});
|
||||
this.onWebviewOrCore("openFile", async (msg) => {
|
||||
return await ide.openFile(msg.data.path);
|
||||
return ide.openFile(msg.data.path);
|
||||
});
|
||||
this.onWebviewOrCore("runCommand", async (msg) => {
|
||||
await ide.runCommand(msg.data.command);
|
||||
});
|
||||
this.onWebviewOrCore("getSearchResults", async (msg) => {
|
||||
return await ide.getSearchResults(msg.data.query);
|
||||
return ide.getSearchResults(msg.data.query);
|
||||
});
|
||||
this.onWebviewOrCore("subprocess", async (msg) => {
|
||||
return await ide.subprocess(msg.data.command);
|
||||
return ide.subprocess(msg.data.command);
|
||||
});
|
||||
this.onWebviewOrCore("getProblems", async (msg) => {
|
||||
return await ide.getProblems(msg.data.filepath);
|
||||
return ide.getProblems(msg.data.filepath);
|
||||
});
|
||||
this.onWebviewOrCore("getBranch", async (msg) => {
|
||||
const { dir } = msg.data;
|
||||
return await ide.getBranch(dir);
|
||||
return ide.getBranch(dir);
|
||||
});
|
||||
this.onWebviewOrCore("getOpenFiles", async (msg) => {
|
||||
return await ide.getOpenFiles();
|
||||
return ide.getOpenFiles();
|
||||
});
|
||||
this.onWebviewOrCore("getCurrentFile", async () => {
|
||||
return await ide.getCurrentFile();
|
||||
return ide.getCurrentFile();
|
||||
});
|
||||
this.onWebviewOrCore("getPinnedFiles", async (msg) => {
|
||||
return await ide.getPinnedFiles();
|
||||
return ide.getPinnedFiles();
|
||||
});
|
||||
this.onWebviewOrCore("showLines", async (msg) => {
|
||||
const { filepath, startLine, endLine } = msg.data;
|
||||
return await ide.showLines(filepath, startLine, endLine);
|
||||
return ide.showLines(filepath, startLine, endLine);
|
||||
});
|
||||
// Other
|
||||
this.onWebviewOrCore("errorPopup", (msg) => {
|
||||
|
|
@ -278,5 +278,8 @@ export class VsCodeMessenger {
|
|||
}
|
||||
});
|
||||
});
|
||||
this.onWebviewOrCore("getGitHubAuthToken", (msg) =>
|
||||
ide.getGitHubAuthToken(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager";
|
|||
import { VsCodeIde } from "../ideProtocol";
|
||||
import { registerAllCodeLensProviders } from "../lang-server/codeLens";
|
||||
import { setupRemoteConfigSync } from "../stubs/activation";
|
||||
import { getUserToken } from "../stubs/auth";
|
||||
import { TabAutocompleteModel } from "../util/loadAutocompleteModel";
|
||||
import type { VsCodeWebviewProtocol } from "../webviewProtocol";
|
||||
import { VsCodeMessenger } from "./VsCodeMessenger";
|
||||
|
|
@ -39,48 +38,27 @@ export class VsCodeExtension {
|
|||
constructor(context: vscode.ExtensionContext) {
|
||||
this.diffManager = new DiffManager(context);
|
||||
this.ide = new VsCodeIde(this.diffManager);
|
||||
this.extensionContext = context;
|
||||
this.windowId = uuidv4();
|
||||
|
||||
const ideSettings = this.ide.getIdeSettings();
|
||||
const { remoteConfigServerUrl } = ideSettings;
|
||||
|
||||
// Config Handler with output channel
|
||||
const outputChannel = vscode.window.createOutputChannel(
|
||||
"Continue - LLM Prompt/Completion",
|
||||
);
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
Promise.resolve(ideSettings),
|
||||
async (log: string) => {
|
||||
outputChannel.appendLine(
|
||||
"==========================================================================",
|
||||
);
|
||||
outputChannel.appendLine(
|
||||
"==========================================================================",
|
||||
);
|
||||
outputChannel.append(log);
|
||||
// Dependencies of core
|
||||
let resolveVerticalDiffManager: any = undefined;
|
||||
const verticalDiffManagerPromise = new Promise<VerticalPerLineDiffManager>(
|
||||
(resolve) => {
|
||||
resolveVerticalDiffManager = resolve;
|
||||
},
|
||||
(() => this.webviewProtocol?.request("configUpdate", undefined)).bind(
|
||||
this,
|
||||
),
|
||||
);
|
||||
|
||||
this.configHandler.reloadConfig();
|
||||
this.verticalDiffManager = new VerticalPerLineDiffManager(
|
||||
this.configHandler,
|
||||
);
|
||||
this.extensionContext = context;
|
||||
this.tabAutocompleteModel = new TabAutocompleteModel(this.configHandler);
|
||||
this.windowId = uuidv4();
|
||||
let resolveConfigHandler: any = undefined;
|
||||
const configHandlerPromise = new Promise<ConfigHandler>((resolve) => {
|
||||
resolveConfigHandler = resolve;
|
||||
});
|
||||
this.sidebar = new ContinueGUIWebviewViewProvider(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
configHandlerPromise,
|
||||
this.windowId,
|
||||
this.extensionContext,
|
||||
this.verticalDiffManager,
|
||||
);
|
||||
|
||||
setupRemoteConfigSync(
|
||||
this.configHandler.reloadConfig.bind(this.configHandler),
|
||||
);
|
||||
|
||||
// Sidebar
|
||||
|
|
@ -95,9 +73,10 @@ export class VsCodeExtension {
|
|||
);
|
||||
this.webviewProtocol = this.sidebar.webviewProtocol;
|
||||
|
||||
// Indexing + pause token
|
||||
this.diffManager.webviewProtocol = this.webviewProtocol;
|
||||
|
||||
// Config Handler with output channel
|
||||
const outputChannel = vscode.window.createOutputChannel(
|
||||
"Continue - LLM Prompt/Completion",
|
||||
);
|
||||
const inProcessMessenger = new InProcessMessenger<
|
||||
ToCoreProtocol,
|
||||
FromCoreProtocol
|
||||
|
|
@ -106,19 +85,37 @@ export class VsCodeExtension {
|
|||
inProcessMessenger,
|
||||
this.webviewProtocol,
|
||||
this.ide,
|
||||
this.verticalDiffManager,
|
||||
verticalDiffManagerPromise,
|
||||
);
|
||||
this.core = new Core(inProcessMessenger, this.ide, async (log: string) => {
|
||||
outputChannel.appendLine(
|
||||
"==========================================================================",
|
||||
);
|
||||
outputChannel.appendLine(
|
||||
"==========================================================================",
|
||||
);
|
||||
outputChannel.append(log);
|
||||
});
|
||||
this.configHandler = this.core.configHandler;
|
||||
resolveConfigHandler?.(this.configHandler);
|
||||
this.configHandler.onConfigUpdate(() => {
|
||||
this.webviewProtocol?.request("configUpdate", undefined);
|
||||
});
|
||||
|
||||
this.configHandler.reloadConfig();
|
||||
this.verticalDiffManager = new VerticalPerLineDiffManager(
|
||||
this.configHandler,
|
||||
);
|
||||
resolveVerticalDiffManager?.(this.verticalDiffManager);
|
||||
this.tabAutocompleteModel = new TabAutocompleteModel(this.configHandler);
|
||||
|
||||
setupRemoteConfigSync(
|
||||
this.configHandler.reloadConfig.bind(this.configHandler),
|
||||
);
|
||||
this.core = new Core(inProcessMessenger, this.ide);
|
||||
|
||||
if (
|
||||
!(
|
||||
remoteConfigServerUrl === null ||
|
||||
remoteConfigServerUrl === undefined ||
|
||||
remoteConfigServerUrl.trim() === ""
|
||||
)
|
||||
) {
|
||||
getUserToken().then((token) => {});
|
||||
}
|
||||
// Indexing + pause token
|
||||
this.diffManager.webviewProtocol = this.webviewProtocol;
|
||||
|
||||
// CodeLens
|
||||
const verticalDiffCodeLens = registerAllCodeLensProviders(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ import type {
|
|||
} from "core";
|
||||
import { defaultIgnoreFile } from "core/indexing/ignore";
|
||||
import { IdeSettings } from "core/protocol/ideWebview";
|
||||
import { getContinueGlobalPath } from "core/util/paths";
|
||||
import {
|
||||
editConfigJson,
|
||||
getConfigJsonPath,
|
||||
getContinueGlobalPath,
|
||||
} from "core/util/paths";
|
||||
import * as vscode from "vscode";
|
||||
import { DiffManager } from "./diff/horizontal";
|
||||
import { Repository } from "./otherExtensions/git";
|
||||
|
|
@ -33,6 +37,52 @@ class VsCodeIde implements IDE {
|
|||
this.ideUtils = new VsCodeIdeUtils();
|
||||
}
|
||||
|
||||
private authToken: string | undefined;
|
||||
private askedForAuth = false;
|
||||
|
||||
async getGitHubAuthToken(): Promise<string | undefined> {
|
||||
if (this.authToken) {
|
||||
return this.authToken;
|
||||
}
|
||||
try {
|
||||
const session = await vscode.authentication.getSession("github", [], {
|
||||
silent: this.askedForAuth,
|
||||
createIfNone: !this.askedForAuth,
|
||||
});
|
||||
if (session) {
|
||||
this.authToken = session.accessToken;
|
||||
return session.accessToken;
|
||||
} else if (!this.askedForAuth) {
|
||||
// User cancelled the login prompt
|
||||
// Explain that they can avoid the prompt by removing free trial models from config.json
|
||||
vscode.window
|
||||
.showInformationMessage(
|
||||
"We'll only ask you to log in if using the free trial. To avoid this prompt, make sure to remove free trial models from your config.json",
|
||||
"Remove for me",
|
||||
"Open config.json",
|
||||
)
|
||||
.then((selection) => {
|
||||
if (selection === "Remove for me") {
|
||||
editConfigJson((configJson) => {
|
||||
configJson.models = configJson.models.filter(
|
||||
(model) => model.provider !== "free-trial",
|
||||
);
|
||||
configJson.tabAutocompleteModel = undefined;
|
||||
return configJson;
|
||||
});
|
||||
} else if (selection === "Open config.json") {
|
||||
this.openFile(getConfigJsonPath());
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to get GitHub authentication session:", error);
|
||||
} finally {
|
||||
this.askedForAuth = true;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async infoPopup(message: string): Promise<void> {
|
||||
vscode.window.showInformationMessage(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,6 +153,26 @@ export class VsCodeWebviewProtocol
|
|||
this.request("setupLocalModel", undefined);
|
||||
}
|
||||
});
|
||||
} else if (message.includes("Please sign in with GitHub")) {
|
||||
vscode.window
|
||||
.showInformationMessage(
|
||||
message,
|
||||
"Sign In",
|
||||
"Use API key / local model",
|
||||
)
|
||||
.then((selection) => {
|
||||
if (selection === "Sign In") {
|
||||
vscode.authentication
|
||||
.getSession("github", [], {
|
||||
createIfNone: true,
|
||||
})
|
||||
.then(() => {
|
||||
this.reloadConfig();
|
||||
});
|
||||
} else if (selection === "Use API key / local model") {
|
||||
this.request("openOnboarding", undefined);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vscode.window
|
||||
.showErrorMessage(message, "Show Logs", "Troubleshooting")
|
||||
|
|
@ -175,7 +195,7 @@ export class VsCodeWebviewProtocol
|
|||
});
|
||||
}
|
||||
|
||||
constructor() {}
|
||||
constructor(private readonly reloadConfig: () => void) {}
|
||||
invoke<T extends keyof ToCoreOrIdeFromWebviewProtocol>(
|
||||
messageType: T,
|
||||
data: ToCoreOrIdeFromWebviewProtocol[T][0],
|
||||
|
|
|
|||
2
gui/package-lock.json
generated
2
gui/package-lock.json
generated
|
|
@ -80,7 +80,7 @@
|
|||
},
|
||||
"../core": {
|
||||
"name": "@continuedev/core",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.13",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
|
||||
|
|
|
|||
BIN
gui/public/logos/fireworks.png
Normal file
BIN
gui/public/logos/fireworks.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
|
|
@ -17,6 +17,8 @@ import useSubmenuContextProviders from "./hooks/useSubmenuContextProviders";
|
|||
import { useVscTheme } from "./hooks/useVscTheme";
|
||||
import GUI from "./pages/gui";
|
||||
import LocalOnboarding from "./pages/localOnboarding";
|
||||
import ApiKeyAutocompleteOnboarding from "./pages/onboarding/apiKeyAutocompleteOnboarding";
|
||||
import ApiKeyOnboarding from "./pages/onboarding/apiKeyOnboarding";
|
||||
import ExistingUserOnboarding from "./pages/onboarding/existingUserOnboarding";
|
||||
import Onboarding from "./pages/onboarding/onboarding";
|
||||
import Stats from "./pages/stats";
|
||||
|
|
@ -83,6 +85,14 @@ const router = createMemoryRouter([
|
|||
path: "/migration",
|
||||
element: <MigrationPage />,
|
||||
},
|
||||
{
|
||||
path: "/apiKeyOnboarding",
|
||||
element: <ApiKeyOnboarding />,
|
||||
},
|
||||
{
|
||||
path: "/apiKeyAutocompleteOnboarding",
|
||||
element: <ApiKeyAutocompleteOnboarding />,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import { defaultModelSelector } from "../redux/selectors/modelSelectors";
|
|||
import {
|
||||
setBottomMessage,
|
||||
setBottomMessageCloseTimeout,
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../redux/slices/uiStateSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
|
|
@ -31,7 +30,6 @@ import { ftl } from "./dialogs/FTCDialog";
|
|||
import IndexingProgressBar from "./loaders/IndexingProgressBar";
|
||||
import ProgressBar from "./loaders/ProgressBar";
|
||||
import ModelSelect from "./modelSelection/ModelSelect";
|
||||
import QuickModelSetup from "./modelSelection/quickSetup/QuickModelSetup";
|
||||
|
||||
// #region Styled Components
|
||||
const FOOTER_HEIGHT = "1.8em";
|
||||
|
|
@ -93,7 +91,9 @@ const DropdownPortalDiv = styled.div`
|
|||
const HIDE_FOOTER_ON_PAGES = [
|
||||
"/onboarding",
|
||||
"/existingUserOnboarding",
|
||||
"/onboarding",
|
||||
"/localOnboarding",
|
||||
"/apiKeyOnboarding",
|
||||
];
|
||||
|
||||
const Layout = () => {
|
||||
|
|
@ -175,8 +175,15 @@ const Layout = () => {
|
|||
useWebviewListener(
|
||||
"addApiKey",
|
||||
async () => {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(setDialogMessage(<QuickModelSetup />));
|
||||
navigate("/apiKeyOnboarding");
|
||||
},
|
||||
[navigate],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"openOnboarding",
|
||||
async () => {
|
||||
navigate("/onboarding");
|
||||
},
|
||||
[navigate],
|
||||
);
|
||||
|
|
@ -212,18 +219,14 @@ const Layout = () => {
|
|||
!location.pathname.startsWith("/onboarding") &&
|
||||
!location.pathname.startsWith("/existingUserOnboarding")
|
||||
) {
|
||||
if (getLocalStorage("mainTextEntryCounter")) {
|
||||
navigate("/existingUserOnboarding");
|
||||
} else {
|
||||
navigate("/onboarding");
|
||||
}
|
||||
navigate("/onboarding");
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const [indexingState, setIndexingState] = useState<IndexingProgressUpdate>({
|
||||
desc: "Indexing disabled",
|
||||
const [indexingState, setIndexingState] = useState<IndexingProgressUpdate>({
|
||||
desc: "Loading indexing config",
|
||||
progress: 0.0,
|
||||
status: "disabled",
|
||||
status: "loading",
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -51,10 +51,28 @@ const P = styled.p`
|
|||
`;
|
||||
|
||||
interface ProgressBarProps {
|
||||
indexingState: IndexingProgressUpdate;
|
||||
indexingState?: IndexingProgressUpdate;
|
||||
}
|
||||
|
||||
const IndexingProgressBar = ({ indexingState }: ProgressBarProps) => {
|
||||
const IndexingProgressBar = ({ indexingState: indexingStateProp }: ProgressBarProps) => {
|
||||
// If sidebar is opened before extension initiates, define a default indexingState
|
||||
const defaultIndexingState: IndexingProgressUpdate = {
|
||||
status: 'loading',
|
||||
progress: 0,
|
||||
desc: ''
|
||||
};
|
||||
const indexingState = indexingStateProp || defaultIndexingState;
|
||||
|
||||
// If sidebar is opened after extension initializes, retrieve saved states.
|
||||
let initialized = false
|
||||
useEffect(() => {
|
||||
if (!initialized) {
|
||||
// Triggers retrieval for possible non-default states set prior to IndexingProgressBar initialization
|
||||
ideMessenger.post("index/indexingProgressBarInitialized", undefined)
|
||||
initialized = true
|
||||
}
|
||||
}, []);
|
||||
|
||||
const fillPercentage = Math.min(
|
||||
100,
|
||||
Math.max(0, indexingState.progress * 100),
|
||||
|
|
@ -87,7 +105,7 @@ const IndexingProgressBar = ({ indexingState }: ProgressBarProps) => {
|
|||
}}
|
||||
className="cursor-pointer"
|
||||
>
|
||||
{indexingState.status === "starting" ? ( // ice-blue 'indexing starting up' dot
|
||||
{indexingState.status === "loading" ? ( // ice-blue 'indexing loading' dot
|
||||
<>
|
||||
<CircleDiv
|
||||
data-tooltip-id="indexingNotLoaded_dot"
|
||||
|
|
@ -96,7 +114,7 @@ const IndexingProgressBar = ({ indexingState }: ProgressBarProps) => {
|
|||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id="indexingNotLoaded_dot" place="top">
|
||||
Codebase indexing is starting up.
|
||||
Continue is initializing
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import ReactDOM from "react-dom";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { StyledTooltip, lightGray, vscForeground } from "..";
|
||||
import {
|
||||
|
|
@ -52,6 +53,7 @@ interface ProgressBarProps {
|
|||
|
||||
const ProgressBar = ({ completed, total }: ProgressBarProps) => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const fillPercentage = Math.min(100, Math.max(0, (completed / total) * 100));
|
||||
|
||||
const tooltipPortalDiv = document.getElementById("tooltip-portal-div");
|
||||
|
|
@ -62,7 +64,16 @@ const ProgressBar = ({ completed, total }: ProgressBarProps) => {
|
|||
data-tooltip-id="usage_progress_bar"
|
||||
onClick={() => {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(setDialogMessage(<QuickModelSetup />));
|
||||
dispatch(
|
||||
setDialogMessage(
|
||||
<QuickModelSetup
|
||||
onDone={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
navigate("/");
|
||||
}}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
}}
|
||||
>
|
||||
<ProgressBarWrapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
import { useContext, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Button, Input, SecondaryButton, vscForeground } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { isJetBrains } from "../../../util";
|
||||
import { setLocalStorage } from "../../../util/localStorage";
|
||||
|
||||
interface GitHubSignInButtonProps {
|
||||
onComplete: (token: string) => void;
|
||||
}
|
||||
|
||||
function GitHubSignInButton(props: GitHubSignInButtonProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [jbGhAuthToken, setJbGhAuthToken] = useState("");
|
||||
|
||||
return isJetBrains() ? (
|
||||
<div className="text-center">
|
||||
<div className="flex justify-center">
|
||||
<SecondaryButton
|
||||
onClick={() => {
|
||||
ideMessenger.post(
|
||||
"openUrl",
|
||||
"https://github.com/settings/tokens/new?scopes=user:email&description=Continue%20Free%20Trial%20Token%20",
|
||||
);
|
||||
}}
|
||||
className="grid grid-flow-col items-center gap-2"
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 98 96"
|
||||
height={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"
|
||||
fill={vscForeground}
|
||||
/>
|
||||
</svg>
|
||||
Generate Token
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<Input
|
||||
placeholder="Paste token here"
|
||||
value={jbGhAuthToken}
|
||||
onChange={(e) => setJbGhAuthToken(e.target.value)}
|
||||
/>
|
||||
<Button
|
||||
disabled={!jbGhAuthToken}
|
||||
onClick={async () => {
|
||||
await ideMessenger.request("setGitHubAuthToken", {
|
||||
token: jbGhAuthToken,
|
||||
});
|
||||
setLocalStorage("signedInToGh", true);
|
||||
props.onComplete(jbGhAuthToken);
|
||||
}}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex justify-center">
|
||||
<SecondaryButton
|
||||
onClick={async () => {
|
||||
const token = await ideMessenger.request(
|
||||
"getGitHubAuthToken",
|
||||
undefined,
|
||||
);
|
||||
setLocalStorage("signedInToGh", true);
|
||||
props.onComplete(token);
|
||||
}}
|
||||
className="grid grid-flow-col items-center gap-2"
|
||||
>
|
||||
<svg viewBox="0 0 98 96" height={24} xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"
|
||||
fill={vscForeground}
|
||||
/>
|
||||
</svg>
|
||||
Sign in with GitHub
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default GitHubSignInButton;
|
||||
|
|
@ -5,13 +5,15 @@ import { useNavigate } from "react-router-dom";
|
|||
import { Button, Input, SecondaryButton } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { setDefaultModel } from "../../../redux/slices/stateSlice";
|
||||
import { setShowDialog } from "../../../redux/slices/uiStateSlice";
|
||||
import { getLocalStorage } from "../../../util/localStorage";
|
||||
import { PROVIDER_INFO } from "../../../util/modelData";
|
||||
import { ftl } from "../../dialogs/FTCDialog";
|
||||
import QuickSetupListBox from "./QuickSetupListBox";
|
||||
|
||||
interface QuickModelSetupProps {}
|
||||
interface QuickModelSetupProps {
|
||||
onDone: () => void;
|
||||
hideFreeTrialLimitMessage?: boolean;
|
||||
}
|
||||
|
||||
function QuickModelSetup(props: QuickModelSetupProps) {
|
||||
const [selectedProvider, setSelectedProvider] = useState(
|
||||
|
|
@ -29,16 +31,18 @@ function QuickModelSetup(props: QuickModelSetupProps) {
|
|||
setSelectedModel(selectedProvider.packages[0]);
|
||||
}, [selectedProvider]);
|
||||
|
||||
const [hasAddedModel, setHasAddedModel] = useState(false);
|
||||
|
||||
return (
|
||||
<FormProvider {...formMethods}>
|
||||
<div className="p-4">
|
||||
<h1>
|
||||
{/* <h1>
|
||||
{getLocalStorage("ftc") > ftl()
|
||||
? "Set up your own model"
|
||||
: "Add a new model"}
|
||||
</h1>
|
||||
</h1> */}
|
||||
|
||||
{getLocalStorage("ftc") > ftl() && (
|
||||
{!props.hideFreeTrialLimitMessage && getLocalStorage("ftc") > ftl() && (
|
||||
<p className="text-sm text-gray-500">
|
||||
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
|
||||
|
|
@ -127,18 +131,16 @@ function QuickModelSetup(props: QuickModelSetupProps) {
|
|||
};
|
||||
ideMessenger.post("config/addModel", { model });
|
||||
dispatch(setDefaultModel({ title: model.title, force: true }));
|
||||
navigate("/");
|
||||
setHasAddedModel(true);
|
||||
}}
|
||||
className="w-full"
|
||||
>
|
||||
Add Model
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
navigate("/");
|
||||
}}
|
||||
onClick={props.onDone}
|
||||
className="w-full"
|
||||
disabled={!hasAddedModel}
|
||||
>
|
||||
Done
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -1,70 +1,13 @@
|
|||
import { Listbox, Transition } from "@headlessui/react";
|
||||
import { Transition } from "@headlessui/react";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
|
||||
import { Dispatch, Fragment, SetStateAction } from "react";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
vscBackground,
|
||||
vscButtonBackground,
|
||||
vscForeground,
|
||||
vscInputBackground,
|
||||
vscListActiveBackground,
|
||||
vscListActiveForeground,
|
||||
} from "../..";
|
||||
import { DisplayInfo } from "../../../util/modelData";
|
||||
|
||||
const StyledListbox = styled(Listbox)`
|
||||
background-color: ${vscBackground};
|
||||
`;
|
||||
|
||||
const StyledListboxButton = styled(Listbox.Button)`
|
||||
cursor: pointer;
|
||||
background-color: ${vscBackground};
|
||||
text-align: left;
|
||||
border: 1px solid ${vscButtonBackground};
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
|
||||
color: ${vscForeground};
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: ${vscInputBackground};
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledListboxOptions = styled(Listbox.Options)`
|
||||
background-color: ${vscInputBackground};
|
||||
padding: 0;
|
||||
|
||||
border-radius: ${defaultBorderRadius};
|
||||
overflow-y: scroll;
|
||||
z-index: 10;
|
||||
`;
|
||||
|
||||
const StyledListboxOption = styled(Listbox.Option)<{ selected: boolean }>`
|
||||
background-color: ${({ selected }) =>
|
||||
selected ? vscListActiveBackground : vscInputBackground};
|
||||
cursor: pointer;
|
||||
padding: 6px 8px;
|
||||
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
background-color: ${vscListActiveBackground};
|
||||
color: ${vscListActiveForeground};
|
||||
}
|
||||
`;
|
||||
import {
|
||||
StyledListbox,
|
||||
StyledListboxButton,
|
||||
StyledListboxOption,
|
||||
StyledListboxOptions,
|
||||
} from "./StyledListbox";
|
||||
|
||||
interface QuickSetupListBoxProps {
|
||||
selectedProvider: DisplayInfo;
|
||||
|
|
@ -80,7 +23,7 @@ function QuickSetupListBox({
|
|||
return (
|
||||
<StyledListbox value={selectedProvider} onChange={setSelectedProvider}>
|
||||
<div className="relative mt-1">
|
||||
<StyledListboxButton className="relative w-full cursor-default rounded-lg bg-white py-2 pl-3 pr-10 text-left shadow-md focus:outline-none sm:text-sm">
|
||||
<StyledListboxButton>
|
||||
<span className="flex items-center">
|
||||
{window.vscMediaUrl && selectedProvider.icon && (
|
||||
<img
|
||||
|
|
@ -104,7 +47,7 @@ function QuickSetupListBox({
|
|||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
>
|
||||
<StyledListboxOptions className="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg focus:outline-none sm:text-sm">
|
||||
<StyledListboxOptions>
|
||||
{options.map((option, index) => (
|
||||
<StyledListboxOption
|
||||
selected={selectedProvider.title === option.title}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
import { Listbox } from "@headlessui/react";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
vscBackground,
|
||||
vscButtonBackground,
|
||||
vscForeground,
|
||||
vscInputBackground,
|
||||
vscListActiveBackground,
|
||||
vscListActiveForeground,
|
||||
} from "../..";
|
||||
|
||||
export const StyledListbox = styled(Listbox)`
|
||||
background-color: ${vscBackground};
|
||||
`;
|
||||
|
||||
export const StyledListboxButton = styled(Listbox.Button)`
|
||||
cursor: pointer;
|
||||
background-color: ${vscBackground};
|
||||
text-align: left;
|
||||
|
||||
padding-left: 0.75rem;
|
||||
padding-right: 2.5rem;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid ${vscButtonBackground};
|
||||
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
position: relative;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
|
||||
color: ${vscForeground};
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: ${vscInputBackground};
|
||||
}
|
||||
`;
|
||||
|
||||
export const StyledListboxOptions = styled(Listbox.Options)`
|
||||
background-color: ${vscInputBackground};
|
||||
padding: 0;
|
||||
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
margin-top: 0.25rem;
|
||||
|
||||
max-height: 15rem;
|
||||
overflow: auto;
|
||||
|
||||
border-radius: ${defaultBorderRadius};
|
||||
overflow-y: scroll;
|
||||
z-index: 10;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
`;
|
||||
|
||||
export const StyledListboxOption = styled(Listbox.Option)<{
|
||||
selected: boolean;
|
||||
}>`
|
||||
background-color: ${({ selected }) =>
|
||||
selected ? vscListActiveBackground : vscInputBackground};
|
||||
cursor: pointer;
|
||||
padding: 6px 8px;
|
||||
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
background-color: ${vscListActiveBackground};
|
||||
color: ${vscListActiveForeground};
|
||||
}
|
||||
`;
|
||||
|
|
@ -8,13 +8,14 @@ const emptyJsonContent = () => ({
|
|||
content: [{ type: "paragraph", content: [{ type: "text", text: "" }] }],
|
||||
});
|
||||
|
||||
const MAX_HISTORY_LENGTH = 100;
|
||||
|
||||
export function useInputHistory() {
|
||||
const [inputHistory, setInputHistory] = useState<JSONContent[]>(
|
||||
getLocalStorage("inputHistory") ?? [],
|
||||
);
|
||||
const [pendingInput, setPendingInput] = useState<JSONContent>(
|
||||
emptyJsonContent(),
|
||||
getLocalStorage("inputHistory")?.slice(-MAX_HISTORY_LENGTH) ?? [],
|
||||
);
|
||||
const [pendingInput, setPendingInput] =
|
||||
useState<JSONContent>(emptyJsonContent());
|
||||
const [currentIndex, setCurrentIndex] = useState(inputHistory.length);
|
||||
|
||||
function prev(currentInput: JSONContent) {
|
||||
|
|
@ -54,9 +55,12 @@ export function useInputHistory() {
|
|||
setCurrentIndex(inputHistory.length + 1);
|
||||
}
|
||||
setInputHistory((prev) => {
|
||||
return [...prev, inputValue];
|
||||
return [...prev, inputValue].slice(-MAX_HISTORY_LENGTH);
|
||||
});
|
||||
setLocalStorage("inputHistory", [...inputHistory, inputValue]);
|
||||
setLocalStorage(
|
||||
"inputHistory",
|
||||
[...inputHistory, inputValue].slice(-MAX_HISTORY_LENGTH),
|
||||
);
|
||||
}
|
||||
|
||||
const prevRef = useUpdatingRef(prev, [inputHistory]);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import StepContainer from "../components/gui/StepContainer";
|
|||
import TimelineItem from "../components/gui/TimelineItem";
|
||||
import ContinueInputBox from "../components/mainInput/ContinueInputBox";
|
||||
import { defaultInputModifiers } from "../components/mainInput/inputModifiers";
|
||||
import QuickModelSetup from "../components/modelSelection/quickSetup/QuickModelSetup";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import useChatHandler from "../hooks/useChatHandler";
|
||||
import useHistory from "../hooks/useHistory";
|
||||
|
|
@ -248,8 +247,7 @@ function GUI(props: GUIProps) {
|
|||
setLocalStorage("ftc", u + 1);
|
||||
|
||||
if (u >= ftl()) {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(setDialogMessage(<QuickModelSetup />));
|
||||
navigate("/onboarding");
|
||||
posthog?.capture("ftc_reached");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,6 @@ function LocalOnboarding() {
|
|||
|
||||
useEffect(() => {
|
||||
const checkModels = async () => {
|
||||
console.log("Checking models...");
|
||||
const models = await ideMessenger.request("llm/listModels", {
|
||||
title: assumedModelTitle,
|
||||
});
|
||||
|
|
|
|||
213
gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx
Normal file
213
gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
|
||||
import { ModelProvider } from "core";
|
||||
import { TRIAL_FIM_MODEL } from "core/config/onboarding";
|
||||
import { Fragment, useContext, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Button, Input, SecondaryButton } from "../../components";
|
||||
import GitHubSignInButton from "../../components/modelSelection/quickSetup/GitHubSignInButton";
|
||||
import {
|
||||
StyledListbox,
|
||||
StyledListboxButton,
|
||||
StyledListboxOption,
|
||||
StyledListboxOptions,
|
||||
} from "../../components/modelSelection/quickSetup/StyledListbox";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
|
||||
interface AutocompleteOption {
|
||||
provider: ModelProvider;
|
||||
title: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
const AUTOCOMPLETE_PROVIDER_OPTIONS: AutocompleteOption[] = [
|
||||
{
|
||||
provider: "free-trial",
|
||||
title: "Free Trial (Codestral)",
|
||||
// icon: "fireworks.png",
|
||||
},
|
||||
{
|
||||
provider: "fireworks",
|
||||
title: "Fireworks AI",
|
||||
// icon: "fireworks.png",
|
||||
},
|
||||
{
|
||||
provider: "ollama",
|
||||
title: "Ollama",
|
||||
icon: "ollama.png",
|
||||
},
|
||||
];
|
||||
|
||||
interface AutocompleteModelDropdownProps {
|
||||
selectedProvider: AutocompleteOption;
|
||||
setSelectedProvider: any;
|
||||
}
|
||||
|
||||
function AutocompleteModelDropdown({
|
||||
selectedProvider,
|
||||
setSelectedProvider,
|
||||
}: AutocompleteModelDropdownProps) {
|
||||
return (
|
||||
<StyledListbox value={selectedProvider} onChange={setSelectedProvider}>
|
||||
<div className="relative mt-1">
|
||||
<StyledListboxButton>
|
||||
<span className="flex items-center">
|
||||
{window.vscMediaUrl && selectedProvider.icon && (
|
||||
<img
|
||||
src={`${window.vscMediaUrl}/logos/${selectedProvider.icon}`}
|
||||
height="24px"
|
||||
style={{ marginRight: "10px" }}
|
||||
/>
|
||||
)}
|
||||
<span className="text-md">{selectedProvider.title}</span>
|
||||
</span>
|
||||
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
|
||||
<ChevronUpDownIcon
|
||||
className="h-5 w-5 text-gray-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</span>
|
||||
</StyledListboxButton>
|
||||
<Transition
|
||||
as={Fragment}
|
||||
leave="transition ease-in duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
>
|
||||
<StyledListboxOptions>
|
||||
{AUTOCOMPLETE_PROVIDER_OPTIONS.map((option, index) => (
|
||||
<StyledListboxOption
|
||||
selected={selectedProvider.title === option.title}
|
||||
key={index}
|
||||
className={({ active }) =>
|
||||
`relative cursor-default select-none py-2 pl-10 pr-4 ${
|
||||
active ? "bg-amber-100 text-amber-900" : "text-gray-900"
|
||||
}`
|
||||
}
|
||||
value={option}
|
||||
>
|
||||
{({ selected }) => (
|
||||
<>
|
||||
{window.vscMediaUrl && option.icon && (
|
||||
<img
|
||||
src={`${window.vscMediaUrl}/logos/${option.icon}`}
|
||||
height="24px"
|
||||
style={{ marginRight: "10px" }}
|
||||
/>
|
||||
)}
|
||||
<span className="text-md">{option.title}</span>
|
||||
|
||||
{selected ? (
|
||||
<span className="inset-y-0 ml-auto flex items-center pl-3 text-amber-600">
|
||||
<CheckIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</span>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
</StyledListboxOption>
|
||||
))}
|
||||
</StyledListboxOptions>
|
||||
</Transition>
|
||||
</div>
|
||||
</StyledListbox>
|
||||
);
|
||||
}
|
||||
|
||||
function ApiKeyAutocompleteOnboarding() {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [selectedProvider, setSelectedProvider] = useState<AutocompleteOption>(
|
||||
AUTOCOMPLETE_PROVIDER_OPTIONS[0],
|
||||
);
|
||||
|
||||
const [apiKeyValue, setApiKeyValue] = useState<string>("");
|
||||
|
||||
return (
|
||||
<div className="p-2 max-w-96 mt-16 mx-auto">
|
||||
<h1 className="text-center">Autocomplete Model</h1>
|
||||
<p className="text-center">
|
||||
Tab autocomplete requires a separate model. Currently we are supporting
|
||||
free usage by signing in with GitHub. Alternatively, select another
|
||||
option from the dropdown.
|
||||
</p>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<AutocompleteModelDropdown
|
||||
selectedProvider={selectedProvider}
|
||||
setSelectedProvider={setSelectedProvider}
|
||||
></AutocompleteModelDropdown>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
{selectedProvider.provider === "ollama" && (
|
||||
<div className="text-center">
|
||||
<Button
|
||||
onClick={() => {
|
||||
navigate("/localOnboarding");
|
||||
}}
|
||||
>
|
||||
Set up Ollama
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{selectedProvider.provider === "free-trial" && (
|
||||
<div className="text-center">
|
||||
<p>Sign in to GitHub to try autocomplete for free</p>
|
||||
<GitHubSignInButton
|
||||
onComplete={async (token) => {
|
||||
await ideMessenger.request("addAutocompleteModel", {
|
||||
model: {
|
||||
title: "Autocomplete Trial",
|
||||
provider: "free-trial",
|
||||
model: TRIAL_FIM_MODEL,
|
||||
},
|
||||
});
|
||||
navigate("/");
|
||||
}}
|
||||
></GitHubSignInButton>
|
||||
</div>
|
||||
)}
|
||||
{selectedProvider.provider === "fireworks" && (
|
||||
<div className="text-center">
|
||||
<h4>Paste your API key</h4>
|
||||
<SecondaryButton
|
||||
className="w-full border-2 border-solid"
|
||||
onClick={() => {
|
||||
ideMessenger.post("openUrl", "https://fireworks.ai/api-keys");
|
||||
}}
|
||||
>
|
||||
Get API Key
|
||||
</SecondaryButton>
|
||||
<Input
|
||||
id="apiKey"
|
||||
className="w-full"
|
||||
placeholder="Enter API Key"
|
||||
value={apiKeyValue}
|
||||
onChange={(e) => {
|
||||
setApiKeyValue(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await ideMessenger.request("addAutocompleteModel", {
|
||||
model: {
|
||||
title: "Fireworks Autocomplete",
|
||||
provider: "fireworks",
|
||||
model: "starcoder-7b",
|
||||
apiKey: apiKeyValue,
|
||||
},
|
||||
});
|
||||
navigate("/");
|
||||
}}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ApiKeyAutocompleteOnboarding;
|
||||
39
gui/src/pages/onboarding/apiKeyOnboarding.tsx
Normal file
39
gui/src/pages/onboarding/apiKeyOnboarding.tsx
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { Cog6ToothIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import QuickModelSetup from "../../components/modelSelection/quickSetup/QuickModelSetup";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { getLocalStorage } from "../../util/localStorage";
|
||||
|
||||
function ApiKeyOnboarding() {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<div className="p-2 max-w-96 mt-16 mx-auto">
|
||||
<h1 className="text-center">Model Setup</h1>
|
||||
<p className="text-center">
|
||||
To get started, choose a model and enter your API key. You can always
|
||||
reconfigure later by clicking the{" "}
|
||||
<Cog6ToothIcon
|
||||
className="inline-block h-5 w-5 align-middle cursor-pointer"
|
||||
onClick={() => ideMessenger.post("openConfigJson", undefined)}
|
||||
/>{" "}
|
||||
icon in the bottom right.
|
||||
</p>
|
||||
|
||||
<QuickModelSetup
|
||||
onDone={() => {
|
||||
ideMessenger.post("showTutorial", undefined);
|
||||
|
||||
if (getLocalStorage("signedInToGh") === true) {
|
||||
navigate("/");
|
||||
} else {
|
||||
navigate("/apiKeyAutocompleteOnboarding");
|
||||
}
|
||||
}}
|
||||
></QuickModelSetup>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ApiKeyOnboarding;
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { TRIAL_FIM_MODEL } from "core/config/onboarding";
|
||||
import { useContext, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
|
|
@ -83,7 +84,7 @@ function ExistingUserOnboarding() {
|
|||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete",
|
||||
"provider": "free-trial",
|
||||
"model": "starcoder-7b"
|
||||
"model": "${TRIAL_FIM_MODEL}"
|
||||
},
|
||||
// Voyage AI's voyage-code-2
|
||||
"embeddingsProvider": {
|
||||
|
|
@ -100,11 +101,10 @@ Alternatively, you can enter your own API keys:
|
|||
\`\`\`json
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Starcoder 2",
|
||||
"provider": "openai",
|
||||
"model": "accounts/fireworks/models/starcoder-7b",
|
||||
"apiBase": "https://api.fireworks.ai/inference/v1",
|
||||
"apiKey": "FIREWORKS_API_KEY"
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "MISTRAL_API_KEY"
|
||||
}
|
||||
"embeddingsProvider": {
|
||||
"provider": "openai",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import { useContext, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { greenButtonColor } from "../../components";
|
||||
import { ftl } from "../../components/dialogs/FTCDialog";
|
||||
import GitHubSignInButton from "../../components/modelSelection/quickSetup/GitHubSignInButton";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { setLocalStorage } from "../../util/localStorage";
|
||||
import { isJetBrains } from "../../util";
|
||||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
import { Div, StyledButton } from "./components";
|
||||
|
||||
function Onboarding() {
|
||||
|
|
@ -11,16 +14,28 @@ function Onboarding() {
|
|||
|
||||
const [hovered0, setHovered0] = useState(false);
|
||||
const [hovered1, setHovered1] = useState(false);
|
||||
const [hovered2, setHovered2] = useState(false);
|
||||
|
||||
const [selected, setSelected] = useState(-1);
|
||||
|
||||
return (
|
||||
<div className="p-2 max-w-96 mt-16 mx-auto">
|
||||
<h1 className="text-center">Welcome to Continue</h1>
|
||||
<p className="text-center pb-2">
|
||||
Let's find the setup that works best for you
|
||||
</p>
|
||||
{getLocalStorage("ftc") > ftl() ? (
|
||||
<>
|
||||
<h1 className="text-center">Free trial limit reached</h1>
|
||||
<p className="text-center pb-2">
|
||||
To keep using Continue, please enter an API key or set up a local
|
||||
model
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<h1 className="text-center">Welcome to Continue</h1>
|
||||
<p className="text-center pb-2">
|
||||
Let's find the setup that works best for you
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Div
|
||||
color={"#be841b"}
|
||||
disabled={false}
|
||||
|
|
@ -32,22 +47,22 @@ function Onboarding() {
|
|||
onMouseEnter={() => setHovered0(true)}
|
||||
onMouseLeave={() => setHovered0(false)}
|
||||
>
|
||||
<h3>✨ Cloud models</h3>
|
||||
<h3>✨ Use your API key</h3>
|
||||
<p>
|
||||
This is the best experience. Continue will use the strongest available
|
||||
commercial models to index code and answer questions. Code is only
|
||||
ever stored locally.
|
||||
Enter an OpenAI or other API key for the best experience. Continue
|
||||
will use the best available commercial models to index code. Code is
|
||||
only ever stored locally.
|
||||
</p>
|
||||
</Div>
|
||||
{selected === 0 && (
|
||||
<p className="px-3">
|
||||
<b>Chat:</b> Whichever model you choose
|
||||
<br />
|
||||
<br />
|
||||
<b>Embeddings:</b> Voyage Code 2
|
||||
<br />
|
||||
<br />
|
||||
<b>Autocomplete:</b> Starcoder 7b via Fireworks AI (free trial)
|
||||
<br />
|
||||
<br />
|
||||
<b>Chat:</b> GPT-4, Claude 3, and others (free trial)
|
||||
<b>Autocomplete:</b> Starcoder 7B via Fireworks AI
|
||||
</p>
|
||||
)}
|
||||
<br></br>
|
||||
|
|
@ -70,60 +85,16 @@ function Onboarding() {
|
|||
</Div>
|
||||
{selected === 1 && (
|
||||
<p className="px-3">
|
||||
<b>Embeddings:</b> Local sentence-transformers model
|
||||
<br />
|
||||
<br />
|
||||
<b>Autocomplete:</b> Starcoder2 3b (set up with Ollama, LM Studio,
|
||||
etc.)
|
||||
<br />
|
||||
<br />
|
||||
<b>Chat:</b> Llama 3 with Ollama, LM Studio, etc.
|
||||
<br />
|
||||
<br />
|
||||
<b>Embeddings:</b> Nomic Embed
|
||||
<br />
|
||||
<br />
|
||||
<b>Autocomplete:</b> Starcoder2 3B
|
||||
</p>
|
||||
)}
|
||||
<br></br>
|
||||
{/* <p>
|
||||
<a href="https://docs.continue.dev/customization/overview">
|
||||
Read the docs
|
||||
</a>{" "}
|
||||
to learn more and fully customize Continue by opening config.json.
|
||||
</p> */}
|
||||
<Div
|
||||
color={"#1b84be"}
|
||||
disabled={false}
|
||||
selected={selected === 2}
|
||||
hovered={hovered2}
|
||||
onMouseEnter={() => setHovered2(true)}
|
||||
onMouseLeave={() => setHovered2(false)}
|
||||
onClick={() => {
|
||||
setSelected(2);
|
||||
ideMessenger.post("openConfigJson", undefined);
|
||||
}}
|
||||
>
|
||||
<h3>⚙️ Your own models</h3>
|
||||
<p>
|
||||
Continue lets you use your own API key or self-hosted LLMs.{" "}
|
||||
<a href="https://docs.continue.dev/customization/overview">
|
||||
Read the docs
|
||||
</a>{" "}
|
||||
to learn more about using config.json to customize Continue. This can
|
||||
always be done later.
|
||||
</p>
|
||||
</Div>
|
||||
{selected === 2 && (
|
||||
<p className="px-3">
|
||||
Use <code>config.json</code> to configure your own{" "}
|
||||
<a href="https://docs.continue.dev/model-setup/overview">models</a>,{" "}
|
||||
<a href="https://docs.continue.dev/customization/context-providers">
|
||||
context providers
|
||||
</a>
|
||||
,{" "}
|
||||
<a href="https://docs.continue.dev/customization/slash-commands">
|
||||
slash commands
|
||||
</a>
|
||||
, and <a href="https://docs.continue.dev/reference/config">more</a>.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<br />
|
||||
<div className="flex">
|
||||
<StyledButton
|
||||
|
|
@ -131,13 +102,13 @@ function Onboarding() {
|
|||
selected === 0
|
||||
? "#be841b"
|
||||
: selected === 1
|
||||
? greenButtonColor
|
||||
: "#1b84be"
|
||||
? greenButtonColor
|
||||
: "#1b84be"
|
||||
}
|
||||
disabled={selected < 0}
|
||||
onClick={() => {
|
||||
ideMessenger.post("completeOnboarding", {
|
||||
mode: ["optimized", "local", "custom"][selected] as any,
|
||||
mode: ["apiKeys", "local"][selected] as any,
|
||||
});
|
||||
setLocalStorage("onboardingComplete", true);
|
||||
|
||||
|
|
@ -146,15 +117,32 @@ function Onboarding() {
|
|||
} else {
|
||||
// Only needed when we switch from the default (local) embeddings provider
|
||||
ideMessenger.post("index/forceReIndex", undefined);
|
||||
// Don't show the tutorial above yet because there's another step to complete at /localOnboarding
|
||||
ideMessenger.post("showTutorial", undefined);
|
||||
navigate("/");
|
||||
navigate("/apiKeyOnboarding");
|
||||
}
|
||||
}}
|
||||
>
|
||||
Continue
|
||||
</StyledButton>
|
||||
</div>
|
||||
|
||||
{(!getLocalStorage("onboardingComplete") || isJetBrains()) && (
|
||||
<>
|
||||
<hr className="w-full my-12"></hr>
|
||||
|
||||
<p className="text-center">
|
||||
OR sign in with GitHub to try 25 free requests
|
||||
</p>
|
||||
<GitHubSignInButton
|
||||
onComplete={async (token) => {
|
||||
setLocalStorage("onboardingComplete", true);
|
||||
await ideMessenger.request("completeOnboarding", {
|
||||
mode: "freeTrial",
|
||||
});
|
||||
navigate("/");
|
||||
}}
|
||||
></GitHubSignInButton>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ type LocalStorageTypes = {
|
|||
inputHistory: JSONContent[];
|
||||
extensionVersion: string;
|
||||
indexingState: IndexingProgressUpdate;
|
||||
signedInToGh: boolean;
|
||||
};
|
||||
|
||||
export function getLocalStorage<T extends keyof LocalStorageTypes>(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ This is the data that populates the model selection page.
|
|||
|
||||
import { ModelName, ModelProvider } from "core";
|
||||
import _ from "lodash";
|
||||
import { ftl } from "../components/dialogs/FTCDialog";
|
||||
|
||||
export function updatedObj(old: any, pathToValue: { [key: string]: any }) {
|
||||
const newObject = _.cloneDeep(old);
|
||||
|
|
@ -348,10 +349,10 @@ const phindCodeLlama: ModelPackage = {
|
|||
providerOptions: ["ollama", "lmstudio", "llamacpp", "replicate", "freetrial"],
|
||||
};
|
||||
|
||||
const mistral: ModelPackage = {
|
||||
title: "Mistral (7b)",
|
||||
const mistralOs: ModelPackage = {
|
||||
title: "Mistral",
|
||||
description:
|
||||
"A 7b parameter base model created by Mistral AI, very competent for code generation and other tasks",
|
||||
"A series of open-weight models created by Mistral AI, highly competent for code generation and other tasks",
|
||||
params: {
|
||||
title: "Mistral",
|
||||
model: "mistral-7b",
|
||||
|
|
@ -377,60 +378,77 @@ const mistral: ModelPackage = {
|
|||
providerOptions: ["ollama", "lmstudio", "together", "llamacpp", "replicate"],
|
||||
};
|
||||
|
||||
const mistralTiny: ModelPackage = {
|
||||
title: "Mistral Tiny (7b)",
|
||||
description: "An 7b parameter model created by Mistral AI",
|
||||
const codestral: ModelPackage = {
|
||||
title: "Codestral",
|
||||
description:
|
||||
"Codestral is an advanced generative model created by Mistral AI, tailored for coding tasks like fill-in-the-middle and code completion. Trained on more than 80 programming languages, Codestral demonstrates proficiency in both widely-used and less-common languages.",
|
||||
params: {
|
||||
title: "Mistral",
|
||||
model: "mistral-tiny",
|
||||
contextLength: 4096,
|
||||
title: "Codestral",
|
||||
model: "codestral-latest",
|
||||
contextLength: 32000,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: [
|
||||
"ollama",
|
||||
"lmstudio",
|
||||
"together",
|
||||
"llamacpp",
|
||||
"replicate",
|
||||
"mistral",
|
||||
],
|
||||
providerOptions: ["mistral"],
|
||||
};
|
||||
const mistral7b: ModelPackage = {
|
||||
title: "Mistral 7B",
|
||||
description:
|
||||
"The first dense model released by Mistral AI, perfect for experimentation, customization, and quick iteration. At the time of the release, it matched the capabilities of models up to 30B parameters.",
|
||||
params: {
|
||||
title: "Mistral 7B",
|
||||
model: "open-mistral-7b",
|
||||
contextLength: 32000,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: ["mistral"],
|
||||
};
|
||||
const mistral8x7b: ModelPackage = {
|
||||
title: "Mixtral 8x7B",
|
||||
description:
|
||||
"A sparse mixture of experts model. As such, it leverages up to 45B parameters but only uses about 12B during inference, leading to better inference throughput at the cost of more vRAM.",
|
||||
params: {
|
||||
title: "Mixtral 8x7B",
|
||||
model: "open-mixtral-8x7b",
|
||||
contextLength: 32000,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: ["mistral"],
|
||||
};
|
||||
const mistral8x22b: ModelPackage = {
|
||||
title: "Mistral 8x22B",
|
||||
description:
|
||||
"A bigger sparse mixture of experts model. As such, it leverages up to 141B parameters but only uses about 39B during inference, leading to better inference throughput at the cost of more vRAM.",
|
||||
params: {
|
||||
title: "Mistral 8x22B",
|
||||
model: "open-mixtral-8x22b",
|
||||
contextLength: 64000,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: ["mistral"],
|
||||
};
|
||||
const mistralSmall: ModelPackage = {
|
||||
title: "Mixtral (8x7b)",
|
||||
title: "Mistral Small",
|
||||
description:
|
||||
"An 8x7b parameter Mixture of Experts model created by Mistral AI (a.k.a Mistral Small)",
|
||||
"Suitable for simple tasks that one can do in bulk (Classification, Customer Support, or Text Generation)",
|
||||
params: {
|
||||
title: "Mixtral",
|
||||
model: "mistral-small",
|
||||
contextLength: 4096,
|
||||
title: "Mistral Small",
|
||||
model: "mistral-small-latest",
|
||||
contextLength: 32000,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: [
|
||||
"ollama",
|
||||
"lmstudio",
|
||||
"together",
|
||||
"llamacpp",
|
||||
"replicate",
|
||||
"mistral",
|
||||
],
|
||||
providerOptions: ["mistral"],
|
||||
};
|
||||
const mistralMedium: ModelPackage = {
|
||||
title: "Mistral Medium",
|
||||
description: "A highly capable model created by Mistral AI",
|
||||
const mistralLarge: ModelPackage = {
|
||||
title: "Mistral Large",
|
||||
description:
|
||||
"Mistral's flagship model that's ideal for complex tasks that require large reasoning capabilities or are highly specialized (Synthetic Text Generation, Code Generation, RAG, or Agents).",
|
||||
params: {
|
||||
title: "Mistral Medium",
|
||||
model: "mistral-medium",
|
||||
contextLength: 4096,
|
||||
title: "Mistral Large",
|
||||
model: "mistral-large-latest",
|
||||
contextLength: 32000,
|
||||
},
|
||||
icon: "mistral.png",
|
||||
providerOptions: [
|
||||
"ollama",
|
||||
"lmstudio",
|
||||
"together",
|
||||
"llamacpp",
|
||||
"replicate",
|
||||
"mistral",
|
||||
],
|
||||
providerOptions: ["mistral"],
|
||||
};
|
||||
|
||||
const geminiPro: ModelPackage = {
|
||||
|
|
@ -537,7 +555,7 @@ const osModels = [
|
|||
deepseek,
|
||||
wizardCoder,
|
||||
codeLlamaInstruct,
|
||||
mistral,
|
||||
mistralOs,
|
||||
phindCodeLlama,
|
||||
];
|
||||
|
||||
|
|
@ -663,13 +681,18 @@ export const MODEL_INFO: (ModelPackage | string)[] = [
|
|||
"OpenAI",
|
||||
gpt4o,
|
||||
gpt4turbo,
|
||||
// gpt4,
|
||||
gpt35turbo,
|
||||
"Anthropic",
|
||||
claude3Opus,
|
||||
claude3Sonnet,
|
||||
claude3Haiku,
|
||||
// claude2,
|
||||
"Mistral",
|
||||
codestral,
|
||||
mistralLarge,
|
||||
mistralSmall,
|
||||
mistral8x22b,
|
||||
mistral8x7b,
|
||||
mistral7b,
|
||||
"Cohere",
|
||||
commandR,
|
||||
commandRPlus,
|
||||
|
|
@ -678,9 +701,9 @@ export const MODEL_INFO: (ModelPackage | string)[] = [
|
|||
geminiPro,
|
||||
gemini15Flash,
|
||||
"Open Source",
|
||||
mistralOs,
|
||||
llama3Chat,
|
||||
deepseek,
|
||||
mistral,
|
||||
// wizardCoder,
|
||||
// codeLlamaInstruct,
|
||||
// phindCodeLlama,
|
||||
|
|
@ -752,28 +775,39 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
],
|
||||
apiKeyUrl: "https://console.anthropic.com/account/keys",
|
||||
},
|
||||
cohere: {
|
||||
title: "Cohere",
|
||||
provider: "cohere",
|
||||
refPage: "cohere",
|
||||
mistral: {
|
||||
title: "Mistral API",
|
||||
provider: "mistral",
|
||||
description:
|
||||
"Optimized for enterprise generative AI, search and discovery, and advanced retrieval.",
|
||||
icon: "cohere.png",
|
||||
tags: [ModelProviderTag["Requires API Key"]],
|
||||
longDescription:
|
||||
"To use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.",
|
||||
"The Mistral API provides seamless access to their models, including Codestral, Mistral 8x22B, Mistral Large, and more.",
|
||||
icon: "mistral.png",
|
||||
longDescription: `To get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)`,
|
||||
tags: [
|
||||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: CollectInputType.text,
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Cohere API key",
|
||||
placeholder: "Enter your Mistral API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
],
|
||||
packages: [commandR, commandRPlus],
|
||||
apiKeyUrl: "https://dashboard.cohere.com/api-keys",
|
||||
packages: [
|
||||
codestral,
|
||||
mistralLarge,
|
||||
mistralSmall,
|
||||
mistral8x22b,
|
||||
mistral8x7b,
|
||||
mistral7b,
|
||||
],
|
||||
apiKeyUrl: "https://console.mistral.ai/api-keys/",
|
||||
},
|
||||
ollama: {
|
||||
title: "Ollama",
|
||||
|
|
@ -800,36 +834,27 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
],
|
||||
downloadUrl: "https://ollama.ai/",
|
||||
},
|
||||
together: {
|
||||
title: "TogetherAI",
|
||||
provider: "together",
|
||||
refPage: "togetherllm",
|
||||
cohere: {
|
||||
title: "Cohere",
|
||||
provider: "cohere",
|
||||
refPage: "cohere",
|
||||
description:
|
||||
"Use the TogetherAI API for extremely fast streaming of open-source models",
|
||||
icon: "together.png",
|
||||
longDescription: `Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset`,
|
||||
tags: [
|
||||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
"Optimized for enterprise generative AI, search and discovery, and advanced retrieval.",
|
||||
icon: "cohere.png",
|
||||
tags: [ModelProviderTag["Requires API Key"]],
|
||||
longDescription:
|
||||
"To use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.",
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: CollectInputType.text,
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your TogetherAI API key",
|
||||
placeholder: "Enter your Cohere API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
],
|
||||
packages: [llama3Chat, codeLlamaInstruct, mistral].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
apiKeyUrl: "https://api.together.ai/settings/api-keys",
|
||||
packages: [commandR, commandRPlus],
|
||||
},
|
||||
groq: {
|
||||
title: "Groq",
|
||||
|
|
@ -868,6 +893,36 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
],
|
||||
apiKeyUrl: "https://console.groq.com/keys",
|
||||
},
|
||||
together: {
|
||||
title: "TogetherAI",
|
||||
provider: "together",
|
||||
refPage: "togetherllm",
|
||||
description:
|
||||
"Use the TogetherAI API for extremely fast streaming of open-source models",
|
||||
icon: "together.png",
|
||||
longDescription: `Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset`,
|
||||
tags: [
|
||||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: CollectInputType.text,
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your TogetherAI API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
],
|
||||
packages: [llama3Chat, codeLlamaInstruct, mistralOs].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
},
|
||||
gemini: {
|
||||
title: "Google Gemini API",
|
||||
provider: "gemini",
|
||||
|
|
@ -889,36 +944,6 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
packages: [gemini15Pro, geminiPro, gemini15Flash],
|
||||
apiKeyUrl: "https://aistudio.google.com/app/apikey",
|
||||
},
|
||||
mistral: {
|
||||
title: "Mistral API",
|
||||
provider: "mistral",
|
||||
description:
|
||||
"The Mistral API provides hosted access to their models, including Mistral-7b, Mixtral, and the very capable mistral-medium",
|
||||
icon: "mistral.png",
|
||||
longDescription: `To get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)`,
|
||||
tags: [
|
||||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: CollectInputType.text,
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Mistral API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
],
|
||||
packages: [mistralTiny, mistralSmall, mistralMedium].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
apiKeyUrl: "https://console.mistral.ai/api-keys/",
|
||||
},
|
||||
lmstudio: {
|
||||
title: "LM Studio",
|
||||
provider: "lmstudio",
|
||||
|
|
@ -981,7 +1006,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
packages: [llama3Chat, codeLlamaInstruct, wizardCoder, mistral],
|
||||
packages: [llama3Chat, codeLlamaInstruct, wizardCoder, mistralOs],
|
||||
apiKeyUrl: "https://replicate.com/account/api-tokens",
|
||||
},
|
||||
llamacpp: {
|
||||
|
|
@ -1056,9 +1081,8 @@ After it's up and running, you can start using Continue.`,
|
|||
provider: "free-trial",
|
||||
refPage: "freetrial",
|
||||
description:
|
||||
"New users can try out Continue for free using a proxy server that securely makes calls to OpenAI, Google, or Together using our API key",
|
||||
longDescription:
|
||||
'New users can try out Continue for free using a proxy server that securely makes calls to OpenAI, Google, or Together using our API key. If you are ready to use your own API key or have used all 250 free uses, you can enter your API key in config.json where it says `apiKey=""` or select another model provider.',
|
||||
"New users can try out Continue for free using a proxy server that securely makes calls to OpenAI, Anthropic, or Together using our API key",
|
||||
longDescription: `New users can try out Continue for free using a proxy server that securely makes calls to OpenAI, Anthropic, or Together using our API key. If you are ready to set up a model for long-term use or have used all ${ftl()} free uses, you can enter your API key or use a local model.`,
|
||||
icon: "openai.png",
|
||||
tags: [ModelProviderTag.Free],
|
||||
packages: [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue