Merge branch 'refs/heads/main' into completion_provider_replacement_diffpattern
This commit is contained in:
commit
f1351027ab
50 changed files with 606 additions and 138 deletions
10
.github/workflows/preview.yaml
vendored
10
.github/workflows/preview.yaml
vendored
|
|
@ -4,6 +4,13 @@ on:
|
|||
release:
|
||||
types: [prereleased]
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish_build:
|
||||
description: "Whether or not to publish the built extension to the VS Code marketplace"
|
||||
required: true
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
check_release_name:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -21,7 +28,7 @@ jobs:
|
|||
|
||||
build:
|
||||
needs: check_release_name
|
||||
if: needs.check_release_name.outputs.should_run == 'true'
|
||||
if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
|
|
@ -197,6 +204,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
if: github.event.inputs.publish_build == 'true'
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
|
|
|
|||
2
binary/package-lock.json
generated
2
binary/package-lock.json
generated
|
|
@ -48,7 +48,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.23",
|
||||
"@continuedev/config-yaml": "^1.0.24",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class IPCMessengerBase<
|
|||
|
||||
console.warn(`Error running handler for "${msg.messageType}": `, e);
|
||||
this._onErrorHandlers.forEach((handler) => {
|
||||
handler(e);
|
||||
handler(msg, e);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -112,9 +112,9 @@ class IPCMessengerBase<
|
|||
lines.forEach((line) => this._handleLine(line));
|
||||
}
|
||||
|
||||
private _onErrorHandlers: ((error: Error) => void)[] = [];
|
||||
private _onErrorHandlers: ((message: Message, error: Error) => void)[] = [];
|
||||
|
||||
onError(handler: (error: Error) => void) {
|
||||
onError(handler: (message: Message, error: Error) => void) {
|
||||
this._onErrorHandlers.push(handler);
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ export class CoreBinaryMessenger<
|
|||
extends IPCMessengerBase<ToProtocol, FromProtocol>
|
||||
implements IMessenger<ToProtocol, FromProtocol>
|
||||
{
|
||||
private errorHandler: (error: Error) => void = () => {};
|
||||
private errorHandler: (message: Message, error: Error) => void = () => {};
|
||||
private messageHandlers: Map<
|
||||
keyof ToProtocol,
|
||||
(message: Message<any>) => Promise<any> | any
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ export class TcpMessenger<
|
|||
});
|
||||
}
|
||||
|
||||
private _onErrorHandlers: ((error: Error) => void)[] = [];
|
||||
private _onErrorHandlers: ((message: Message, error: Error) => void)[] = [];
|
||||
|
||||
onError(handler: (error: Error) => void) {
|
||||
onError(handler: (message: Message, error: Error) => void) {
|
||||
this._onErrorHandlers.push(handler);
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ export class TcpMessenger<
|
|||
|
||||
console.warn(`Error running handler for "${msg.messageType}": `, e);
|
||||
this._onErrorHandlers.forEach((handler) => {
|
||||
handler(e);
|
||||
handler(msg, e);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -90,7 +90,12 @@ const getClipboardSnippets = async (
|
|||
const getDiffSnippets = async (
|
||||
ide: IDE,
|
||||
): Promise<AutocompleteDiffSnippet[]> => {
|
||||
const diff = await ide.getDiff(true);
|
||||
let diff: string[] = [];
|
||||
try {
|
||||
diff = await ide.getDiff(true);
|
||||
} catch (e) {
|
||||
console.error("Error getting diff for autocomplete", e);
|
||||
}
|
||||
|
||||
return diff.map((item) => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -365,11 +365,11 @@ export class ConfigHandler {
|
|||
this.updateListeners.push(listener);
|
||||
}
|
||||
|
||||
async reloadConfig(additionalContextProviders: IContextProvider[] = []) {
|
||||
async reloadConfig() {
|
||||
// TODO: this isn't right, there are two different senses in which you want to "reload"
|
||||
|
||||
const { config, errors, configLoadInterrupted } =
|
||||
await this.currentProfile.reloadConfig(additionalContextProviders);
|
||||
await this.currentProfile.reloadConfig(this.additionalContextProviders);
|
||||
|
||||
if (config) {
|
||||
this.inactiveProfiles.forEach((profile) => profile.clearConfig());
|
||||
|
|
@ -419,6 +419,6 @@ export class ConfigHandler {
|
|||
|
||||
registerCustomContextProvider(contextProvider: IContextProvider) {
|
||||
this.additionalContextProviders.push(contextProvider);
|
||||
void this.reloadConfig(this.additionalContextProviders);
|
||||
void this.reloadConfig();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ export class ProfileLifecycleManager {
|
|||
}
|
||||
|
||||
// Clear saved config and reload
|
||||
async reloadConfig(additionalContextProviders: IContextProvider[] = []): Promise<ConfigResult<ContinueConfig>> {
|
||||
async reloadConfig(
|
||||
additionalContextProviders: IContextProvider[] = [],
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
this.savedConfigResult = undefined;
|
||||
this.savedBrowserConfigResult = undefined;
|
||||
this.pendingConfigPromise = undefined;
|
||||
|
|
@ -73,7 +75,21 @@ export class ProfileLifecycleManager {
|
|||
|
||||
// Set pending config promise
|
||||
this.pendingConfigPromise = new Promise(async (resolve, reject) => {
|
||||
const result = await this.profileLoader.doLoadConfig();
|
||||
let result: ConfigResult<ContinueConfig>;
|
||||
try {
|
||||
result = await this.profileLoader.doLoadConfig();
|
||||
} catch (e: any) {
|
||||
result = {
|
||||
errors: [
|
||||
{
|
||||
fatal: true,
|
||||
message: e.message,
|
||||
},
|
||||
],
|
||||
config: undefined,
|
||||
configLoadInterrupted: true,
|
||||
};
|
||||
}
|
||||
|
||||
if (result.config) {
|
||||
// Add registered context providers
|
||||
|
|
|
|||
|
|
@ -5,20 +5,6 @@ import {
|
|||
SlashCommandDescription,
|
||||
} from "../";
|
||||
|
||||
export const DEFAULT_CHAT_MODEL_CONFIG: ModelDescription = {
|
||||
model: "claude-3-5-sonnet-latest",
|
||||
provider: "anthropic",
|
||||
apiKey: "",
|
||||
title: "Claude 3.5 Sonnet",
|
||||
};
|
||||
|
||||
export const DEFAULT_AUTOCOMPLETE_MODEL_CONFIG: ModelDescription = {
|
||||
title: "Codestral",
|
||||
provider: "mistral",
|
||||
model: "codestral-latest",
|
||||
apiKey: "",
|
||||
};
|
||||
|
||||
export const FREE_TRIAL_MODELS: ModelDescription[] = [
|
||||
{
|
||||
title: "Claude 3.5 Sonnet (Free Trial)",
|
||||
|
|
@ -93,15 +79,13 @@ export const defaultSlashCommandsJetBrains = [
|
|||
];
|
||||
|
||||
export const defaultConfig: SerializedContinueConfig = {
|
||||
models: [DEFAULT_CHAT_MODEL_CONFIG],
|
||||
tabAutocompleteModel: DEFAULT_AUTOCOMPLETE_MODEL_CONFIG,
|
||||
models: [],
|
||||
contextProviders: defaultContextProvidersVsCode,
|
||||
slashCommands: defaultSlashCommandsVscode,
|
||||
};
|
||||
|
||||
export const defaultConfigJetBrains: SerializedContinueConfig = {
|
||||
models: [DEFAULT_CHAT_MODEL_CONFIG],
|
||||
tabAutocompleteModel: DEFAULT_AUTOCOMPLETE_MODEL_CONFIG,
|
||||
models: [],
|
||||
contextProviders: defaultContextProvidersJetBrains,
|
||||
slashCommands: defaultSlashCommandsJetBrains,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths";
|
|||
import { Telemetry } from "../../util/posthog";
|
||||
import { TTS } from "../../util/tts";
|
||||
import { loadContinueConfigFromJson } from "../load";
|
||||
import { migrateJsonSharedConfig } from "../migrateSharedConfig";
|
||||
import { loadContinueConfigFromYaml } from "../yaml/loadYaml";
|
||||
import { PlatformConfigMetadata } from "./PlatformProfileLoader";
|
||||
import { migrateJsonSharedConfig } from "../migrateSharedConfig";
|
||||
|
||||
export default async function doLoadConfig(
|
||||
ide: IDE,
|
||||
|
|
|
|||
|
|
@ -69,10 +69,14 @@ class MCPConnection {
|
|||
private constructTransport(options: MCPOptions): Transport {
|
||||
switch (options.transport.type) {
|
||||
case "stdio":
|
||||
const env: Record<string, string> = options.transport.env || {};
|
||||
if (process.env.PATH !== undefined) {
|
||||
env.PATH = process.env.PATH;
|
||||
}
|
||||
return new StdioClientTransport({
|
||||
command: options.transport.command,
|
||||
args: options.transport.args,
|
||||
env: options.transport.env,
|
||||
env,
|
||||
});
|
||||
case "websocket":
|
||||
return new WebSocketClientTransport(new URL(options.transport.url));
|
||||
|
|
|
|||
18
core/core.ts
18
core/core.ts
|
|
@ -57,7 +57,6 @@ import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
|||
import type { IMessenger, Message } from "./protocol/messenger";
|
||||
|
||||
export class Core {
|
||||
// implements IMessenger<ToCoreProtocol, FromCoreProtocol>
|
||||
configHandler: ConfigHandler;
|
||||
codebaseIndexerPromise: Promise<CodebaseIndexer>;
|
||||
completionProvider: CompletionProvider;
|
||||
|
|
@ -209,13 +208,24 @@ export class Core {
|
|||
|
||||
// Note, VsCode's in-process messenger doesn't do anything with this
|
||||
// It will only show for jetbrains
|
||||
this.messenger.onError((err) => {
|
||||
console.error(err);
|
||||
this.messenger.onError((message, err) => {
|
||||
void Telemetry.capture("core_messenger_error", {
|
||||
message: err.message,
|
||||
stack: err.stack,
|
||||
});
|
||||
void this.ide.showToast("error", err.message);
|
||||
|
||||
// Again, specifically for jetbrains to prevent duplicate error messages
|
||||
// The same logic can currently be found in the webview protocol
|
||||
// bc streaming errors are handled in the GUI
|
||||
if (
|
||||
["llm/streamChat", "chatDescriber/describe"].includes(
|
||||
message.messageType,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
} else {
|
||||
void this.ide.showToast("error", err.message);
|
||||
}
|
||||
});
|
||||
|
||||
on("update/selectTabAutocompleteModel", async (msg) => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ModelCapability, TemplateType } from "../index.js";
|
||||
import { ChatMessage, ModelCapability, TemplateType } from "../index.js";
|
||||
|
||||
import {
|
||||
anthropicTemplateMessages,
|
||||
|
|
@ -257,7 +257,10 @@ function autodetectTemplateFunction(
|
|||
const templateType = explicitTemplate ?? autodetectTemplateType(model);
|
||||
|
||||
if (templateType) {
|
||||
const mapping: Record<TemplateType, any> = {
|
||||
const mapping: Record<
|
||||
TemplateType,
|
||||
null | ((msg: ChatMessage[]) => string)
|
||||
> = {
|
||||
llama2: llama2TemplateMessages,
|
||||
alpaca: templateAlpacaMessages,
|
||||
phi2: phi2TemplateMessages,
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ export abstract class BaseLLM implements ILLM {
|
|||
options.model,
|
||||
this.providerName,
|
||||
options.template,
|
||||
);
|
||||
) ??
|
||||
undefined;
|
||||
this.writeLog = options.writeLog;
|
||||
this.llmRequestHook = options.llmRequestHook;
|
||||
this.apiKey = options.apiKey;
|
||||
|
|
@ -957,7 +958,9 @@ export abstract class BaseLLM implements ILLM {
|
|||
this.providerName,
|
||||
autodetectTemplateType(this.model),
|
||||
);
|
||||
return templateMessages(rendered);
|
||||
if (templateMessages) {
|
||||
return templateMessages(rendered);
|
||||
}
|
||||
}
|
||||
return rendered;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ class Novita extends OpenAI {
|
|||
};
|
||||
|
||||
private static MODEL_IDS: { [name: string]: string } = {
|
||||
"deepseek-r1": "deepseek/deepseek-r1",
|
||||
"deepseek_v3": "deepseek/deepseek_v3",
|
||||
"llama3-8b": "meta-llama/llama-3-8b-instruct",
|
||||
"llama3-70b": "meta-llama/llama-3-70b-instruct",
|
||||
"llama3.1-8b": "meta-llama/llama-3.1-8b-instruct",
|
||||
|
|
|
|||
58
core/package-lock.json
generated
58
core/package-lock.json
generated
|
|
@ -13,11 +13,11 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.23",
|
||||
"@continuedev/config-yaml": "^1.0.24",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
@ -3038,9 +3038,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.23",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.23.tgz",
|
||||
"integrity": "sha512-F2Hwc85iCwAHJuwJALOsmZIBeHdF+87mS0YT7dlC6QiE+zAhZKUHcLQ/nTt9bJuhyVyufpb9LApkp40UdGsaWw==",
|
||||
"version": "1.0.24",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.24.tgz",
|
||||
"integrity": "sha512-xA4tRUh9r9p3aHIXr9zl5GQd5VygEusIc7Zw7AAFCbbl6ahMB4CDcweT8+iz0UvxJ11PLYizFSygpvxu/Yl19Q==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
@ -4218,13 +4218,34 @@
|
|||
]
|
||||
},
|
||||
"node_modules/@modelcontextprotocol/sdk": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.0.3.tgz",
|
||||
"integrity": "sha512-2as3cX/VJ0YBHGmdv3GFyTpoM8q2gqE98zh3Vf1NwnsSY0h3mvoO07MUzfygCKkWsFjcZm4otIiqD6Xh7kiSBQ==",
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.4.1.tgz",
|
||||
"integrity": "sha512-wS6YC4lkUZ9QpP+/7NBTlVNiEvsnyl0xF7rRusLF+RsG0xDPc/zWR7fEEyhKnnNutGsDAZh59l/AeoWGwIb1+g==",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
"eventsource": "^3.0.2",
|
||||
"raw-body": "^3.0.0",
|
||||
"zod": "^3.23.8"
|
||||
"zod": "^3.23.8",
|
||||
"zod-to-json-schema": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@modelcontextprotocol/sdk/node_modules/zod": {
|
||||
"version": "3.24.1",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz",
|
||||
"integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
},
|
||||
"node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema": {
|
||||
"version": "3.24.1",
|
||||
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.1.tgz",
|
||||
"integrity": "sha512-3h08nf3Vw3Wl3PK+q3ow/lIil81IT2Oa7YpQyUUDsEWbXveMesdfK1xBd2RhCkynwZndAxixji/7SYJJowr62w==",
|
||||
"peerDependencies": {
|
||||
"zod": "^3.24.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@mozilla/readability": {
|
||||
|
|
@ -8313,6 +8334,25 @@
|
|||
"node": ">=0.8.x"
|
||||
}
|
||||
},
|
||||
"node_modules/eventsource": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.5.tgz",
|
||||
"integrity": "sha512-LT/5J605bx5SNyE+ITBDiM3FxffBiq9un7Vx0EwMDM3vg8sWKx/tO2zC+LMqZ+smAM0F2hblaDZUVZF0te2pSw==",
|
||||
"dependencies": {
|
||||
"eventsource-parser": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eventsource-parser": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.0.tgz",
|
||||
"integrity": "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA==",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/execa": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.23",
|
||||
"@continuedev/config-yaml": "^1.0.24",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -25,15 +25,20 @@ async function renderPromptV1(
|
|||
) {
|
||||
const helpers = getContextProviderHelpers(context);
|
||||
|
||||
// A few context providers that don't need to be in config.json to work in .prompt files
|
||||
const diff = await context.ide.getDiff(true);
|
||||
const currentFile = await context.ide.getCurrentFile();
|
||||
const inputData: Record<string, string> = {
|
||||
diff: diff.join("\n"),
|
||||
input: userInput,
|
||||
};
|
||||
if (currentFile) {
|
||||
inputData.currentFile = currentFile.path;
|
||||
|
||||
// A few context providers that don't need to be in config.json to work in .prompt files
|
||||
if (helpers?.find((helper) => helper[0] === "diff")) {
|
||||
const diff = await context.ide.getDiff(true);
|
||||
inputData.diff = diff.join("\n");
|
||||
}
|
||||
if (helpers?.find((helper) => helper[0] === "currentFile")) {
|
||||
const currentFile = await context.ide.getCurrentFile();
|
||||
if (currentFile) {
|
||||
inputData.currentFile = currentFile.path;
|
||||
}
|
||||
}
|
||||
|
||||
return renderTemplatedString(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export interface IMessenger<
|
|||
ToProtocol extends IProtocol,
|
||||
FromProtocol extends IProtocol,
|
||||
> {
|
||||
onError(handler: (error: Error) => void): void;
|
||||
onError(handler: (message: Message, error: Error) => void): void;
|
||||
send<T extends keyof FromProtocol>(
|
||||
messageType: T,
|
||||
data: FromProtocol[T][0],
|
||||
|
|
@ -64,9 +64,9 @@ export class InProcessMessenger<
|
|||
(message: Message) => any
|
||||
>();
|
||||
|
||||
protected _onErrorHandlers: ((error: Error) => void)[] = [];
|
||||
protected _onErrorHandlers: ((message: Message, error: Error) => void)[] = [];
|
||||
|
||||
onError(handler: (error: Error) => void) {
|
||||
onError(handler: (message: Message, error: Error) => void) {
|
||||
this._onErrorHandlers.push(handler);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ World
|
|||
|
||||
it("should handle strings with only whitespace", () => {
|
||||
const result = dedent`
|
||||
|
||||
|
||||
`;
|
||||
expect(result).toBe("");
|
||||
});
|
||||
|
|
@ -249,9 +249,9 @@ World
|
|||
|
||||
it("should handle a string with only one non-empty line", () => {
|
||||
const result = dedent`
|
||||
|
||||
|
||||
Hello World!
|
||||
|
||||
|
||||
`;
|
||||
expect(result).toBe("Hello World!");
|
||||
});
|
||||
|
|
@ -373,11 +373,16 @@ describe("getMarkdownLanguageTagForFile", () => {
|
|||
expect(getMarkdownLanguageTagForFile("test.py")).toBe("python");
|
||||
expect(getMarkdownLanguageTagForFile("test.tsx")).toBe("tsx");
|
||||
expect(getMarkdownLanguageTagForFile("test.java")).toBe("java");
|
||||
expect(getMarkdownLanguageTagForFile("test.class")).toBe("java");
|
||||
expect(getMarkdownLanguageTagForFile("test.md")).toBe("markdown");
|
||||
expect(getMarkdownLanguageTagForFile("test.sh")).toBe("shell");
|
||||
expect(getMarkdownLanguageTagForFile("test.sql")).toBe("sql");
|
||||
});
|
||||
|
||||
it("should sanitize ranges from the extension", () => {
|
||||
expect(getMarkdownLanguageTagForFile("test.java (1-5)")).toBe("java");
|
||||
});
|
||||
|
||||
it("should return the extension if not in the known list", () => {
|
||||
expect(getMarkdownLanguageTagForFile("file.unknownext")).toBe("unknownext");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ export function getMarkdownLanguageTagForFile(filepath: string): string {
|
|||
tsx: "tsx",
|
||||
ts: "typescript",
|
||||
java: "java",
|
||||
class:"java", //.class files decompile to Java
|
||||
go: "go",
|
||||
rb: "ruby",
|
||||
rs: "rust",
|
||||
|
|
@ -96,17 +97,28 @@ export function getMarkdownLanguageTagForFile(filepath: string): string {
|
|||
ps1: "powershell",
|
||||
};
|
||||
|
||||
const ext = filepath.split(".").pop();
|
||||
const ext = sanitizeExtension(filepath.split(".").pop());
|
||||
return ext ? (extToLangMap[ext] ?? ext) : "";
|
||||
}
|
||||
|
||||
|
||||
function sanitizeExtension(ext?: string): string|undefined {
|
||||
if (ext) {
|
||||
//ignore ranges in extension eg. "java (11-23)"
|
||||
const match = ext.match(/^(\S+)\s*(\(.*\))?$/);
|
||||
if (match) {
|
||||
ext = match[1];
|
||||
}
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
export function copyOf(obj: any): any {
|
||||
if (obj === null || obj === undefined) {
|
||||
return obj;
|
||||
}
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
``;
|
||||
|
||||
export function deduplicateArray<T>(
|
||||
array: T[],
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export async function isOllamaInstalled(): Promise<boolean> {
|
|||
});
|
||||
}
|
||||
|
||||
export async function startLocalOllama(ide: IDE): Promise<void> {
|
||||
export async function startLocalOllama(ide: IDE): Promise<any> {
|
||||
let startCommand: string | undefined;
|
||||
|
||||
switch (process.platform) {
|
||||
|
|
@ -20,16 +20,16 @@ export async function startLocalOllama(ide: IDE): Promise<void> {
|
|||
break;
|
||||
|
||||
case "win32"://Windows
|
||||
startCommand = `& "ollama app.exe"\n`;
|
||||
startCommand = "& \"ollama app.exe\"\n";
|
||||
break;
|
||||
|
||||
default: //Linux...
|
||||
const start_script_path = path.resolve(__dirname, './start_ollama.sh');
|
||||
const start_script_path = path.resolve(__dirname, "./start_ollama.sh");
|
||||
if (await ide.fileExists(`file:/${start_script_path}`)) {
|
||||
startCommand = `set -e && chmod +x ${start_script_path} && ${start_script_path}\n`;
|
||||
console.log(`Ollama Linux startup script at : ${start_script_path}`);
|
||||
} else {
|
||||
ide.showToast("error", `Cannot start Ollama: could not find ${start_script_path}!`)
|
||||
return ide.showToast("error", `Cannot start Ollama: could not find ${start_script_path}!`)
|
||||
}
|
||||
}
|
||||
if (startCommand) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ You can create a project-specific system message by adding a `.continuerules` fi
|
|||
- If you want concise answers:
|
||||
|
||||
```title=.continuerules
|
||||
Please provide concise answers. Do explain obvious concepts. You can assume that I am knowledgable about most programming topics.
|
||||
Please provide concise answers. Don't explain obvious concepts. You can assume that I am knowledgable about most programming topics.
|
||||
```
|
||||
|
||||
- If you want to ensure certain practices are followed, for example in React:
|
||||
|
|
|
|||
|
|
@ -47,7 +47,15 @@ fun showTutorial(project: Project) {
|
|||
throw IOException("Resource not found: $tutorialFileName")
|
||||
}
|
||||
var content = StreamUtil.readText(`is`, StandardCharsets.UTF_8)
|
||||
|
||||
// All jetbrains will use J instead of L
|
||||
content = content.replace("[Cmd + L]", "[Cmd + J]")
|
||||
content = content.replace("[Cmd + Shift + L]", "[Cmd + Shift + J]")
|
||||
|
||||
if (!System.getProperty("os.name").lowercase().contains("mac")) {
|
||||
content = content.replace("[Cmd + J]", "[Ctrl + J]")
|
||||
content = content.replace("[Cmd + Shift + J]", "[Ctrl + Shift + J]")
|
||||
content = content.replace("[Cmd + I]", "[Ctrl + I]")
|
||||
content = content.replace("⌘", "⌃")
|
||||
}
|
||||
val filepath = Paths.get(getContinueGlobalPath(), tutorialFileName).toString()
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ class IntelliJIDE(
|
|||
userToken = settings.continueState.userToken ?: "",
|
||||
enableControlServerBeta = settings.continueState.enableContinueTeamsBeta,
|
||||
pauseCodebaseIndexOnStart = false, // TODO: Needs to be implemented
|
||||
continueTestEnvironment = "none"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ open class ContinueExtensionSettings : PersistentStateComponent<ContinueExtensio
|
|||
var enableOSR: Boolean = shouldRenderOffScreen()
|
||||
var displayEditorTooltip: Boolean = true
|
||||
var showIDECompletionSideBySide: Boolean = false
|
||||
var continueTestEnvironment: String = "none"
|
||||
}
|
||||
|
||||
var continueState: ContinueState = ContinueState()
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ data class IdeSettings(
|
|||
val userToken: String,
|
||||
val enableControlServerBeta: Boolean,
|
||||
val pauseCodebaseIndexOnStart: Boolean,
|
||||
val continueTestEnvironment: String
|
||||
)
|
||||
|
||||
data class ContinueRcJson(
|
||||
|
|
|
|||
|
|
@ -1,17 +1,24 @@
|
|||
/* _________ _____ _____
|
||||
__ ____/______ _______ __ /____(_)_______ ____ _______
|
||||
_ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \
|
||||
/ /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/
|
||||
\____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/
|
||||
// _________ _____ _____
|
||||
// __ ____/______ _______ __ /____(_)_______ ____ _______
|
||||
// _ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \
|
||||
// / /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/
|
||||
// \____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/
|
||||
//
|
||||
// Chat, Edit, and Autocomplete tutorial
|
||||
//
|
||||
|
||||
Chat, Edit, and Autocomplete tutorial
|
||||
*/
|
||||
// ———————————————————————————————————————————————— Setup ————————————————————————————————————————————————-
|
||||
|
||||
// First, open the Continue sidebar by pressing [Cmd + L] or clicking the Continue icon.
|
||||
|
||||
/* ————————————————————————————————————————————————— Chat ————————————————————————————————————————————————— */
|
||||
// See an example at https://docs.continue.dev/getting-started/install
|
||||
|
||||
// Follow the instructions in the sidebar to set up a Chat/Edit modela and an Autocomplete model.
|
||||
|
||||
// ————————————————————————————————————————————————— Chat —————————————————————————————————————————————————
|
||||
|
||||
// Highlight the code below
|
||||
// Press [Cmd/Ctrl + J] to add to Chat
|
||||
// Press [Cmd + L] to add to Chat
|
||||
// Try asking Continue "what sorting algorithm is this?"
|
||||
public static int[] sortingAlgorithm(int[] x) {
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
|
|
@ -26,10 +33,13 @@ public static int[] sortingAlgorithm(int[] x) {
|
|||
return x;
|
||||
}
|
||||
|
||||
/* ————————————————————————————————————————————————— Edit ————————————————————————————————————————————————— */
|
||||
// [Cmd + L] always starts a new chat. Now, try the same thing using [Cmd + Shift + L].
|
||||
// This will add the code into the current chat
|
||||
|
||||
// ————————————————————————————————————————————————— Edit —————————————————————————————————————————————————
|
||||
|
||||
// Highlight the code below
|
||||
// Press [Cmd/Ctrl + I] to Edit
|
||||
// Press [Cmd + I] to Edit
|
||||
// Try asking Continue to "make this more readable"
|
||||
public static int[] sortingAlgorithm2(int[] x) {
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
|
|
@ -44,12 +54,15 @@ public static int[] sortingAlgorithm2(int[] x) {
|
|||
return x;
|
||||
}
|
||||
|
||||
/* ————————————————————————————————————————————— Autocomplete —————————————————————————————————————————————— */
|
||||
// ————————————————————————————————————————————— Autocomplete ——————————————————————————————————————————————
|
||||
|
||||
// Place cursor after `sortingAlgorithm...` below and press [Enter]
|
||||
// Place cursor after `sortingAlgorithm:` below and press [Enter]
|
||||
// Press [Tab] to accept the Autocomplete suggestion
|
||||
|
||||
// Basic assertion for sortingAlgorithm...
|
||||
// Basic assertion for sortingAlgorithm:
|
||||
|
||||
|
||||
/* —————————————————— Learn more at https://docs.continue.dev/getting-started/overview ——————————————————— */
|
||||
|
||||
// —————————————————————————————————————————————- Learn More -——————————————————————————————————————————————
|
||||
|
||||
// Visit the Continue Docs at https://docs.continue.dev/getting-started/overview
|
||||
|
|
|
|||
|
|
@ -7,11 +7,18 @@
|
|||
Chat, Edit, and Autocomplete tutorial
|
||||
"""
|
||||
|
||||
# ———————————————————————————————————————————————— Setup ————————————————————————————————————————————————-
|
||||
|
||||
# ————————————————————————————————————————————————— Chat ————————————————————————————————————————————————— #
|
||||
# First, open the Continue sidebar by pressing [Cmd + L] or clicking the Continue icon.
|
||||
|
||||
# See an example at https://docs.continue.dev/getting-started/install
|
||||
|
||||
# Follow the instructions in the sidebar to set up a Chat/Edit modela and an Autocomplete model.
|
||||
|
||||
# ————————————————————————————————————————————————— Chat —————————————————————————————————————————————————
|
||||
|
||||
## Highlight the code below
|
||||
## Press [Cmd/Ctrl + J] to add to Chat
|
||||
## Press [Cmd + L] to add to Chat
|
||||
## Try asking Continue "what sorting algorithm is this?"
|
||||
def sorting_algorithm(x):
|
||||
for i in range(len(x)):
|
||||
|
|
@ -20,11 +27,13 @@ def sorting_algorithm(x):
|
|||
x[j], x[j + 1] = x[j + 1], x[j]
|
||||
return x
|
||||
|
||||
# [Cmd + L] always starts a new chat. Now, try the same thing using [Cmd + Shift + L].
|
||||
# This will add the code into the current chat
|
||||
|
||||
# ————————————————————————————————————————————————— Edit ————————————————————————————————————————————————— #
|
||||
# ————————————————————————————————————————————————— Edit —————————————————————————————————————————————————
|
||||
|
||||
## Highlight the code below
|
||||
## Press [Cmd/Ctrl + I] to Edit
|
||||
## Press [Cmd + I] to Edit
|
||||
## Try asking Continue to "make this more readable"
|
||||
def sorting_algorithm(x):
|
||||
for i in range(len(x)):
|
||||
|
|
@ -33,12 +42,16 @@ def sorting_algorithm(x):
|
|||
x[j], x[j + 1] = x[j + 1], x[j]
|
||||
return x
|
||||
|
||||
# ————————————————————————————————————————————— Autocomplete —————————————————————————————————————————————— #
|
||||
# ————————————————————————————————————————————— Autocomplete ——————————————————————————————————————————————
|
||||
|
||||
## Place cursor after `sorting_algorithm...` below and press [Enter]
|
||||
## Place cursor after `sorting_algorithm:` below and press [Enter]
|
||||
## Press [Tab] to accept the Autocomplete suggestion
|
||||
|
||||
# Basic assertion for sorting_algorithm...
|
||||
# Basic assertion for sorting_algorithm:
|
||||
|
||||
|
||||
# —————————————————— Learn more at https://docs.continue.dev/getting-started/overview ——————————————————— #
|
||||
|
||||
|
||||
# —————————————————————————————————————————————- Learn More -——————————————————————————————————————————————
|
||||
|
||||
# Visit the Continue Docs at https://docs.continue.dev/getting-started/overview
|
||||
|
|
|
|||
|
|
@ -1,17 +1,24 @@
|
|||
/* _________ _____ _____
|
||||
__ ____/______ _______ __ /____(_)_______ ____ _______
|
||||
_ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \
|
||||
/ /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/
|
||||
\____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/
|
||||
// _________ _____ _____
|
||||
// __ ____/______ _______ __ /____(_)_______ ____ _______
|
||||
// _ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \
|
||||
// / /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/
|
||||
// \____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/
|
||||
//
|
||||
// Chat, Edit, and Autocomplete tutorial
|
||||
//
|
||||
|
||||
Chat, Edit, and Autocomplete tutorial
|
||||
*/
|
||||
// ———————————————————————————————————————————————— Setup ————————————————————————————————————————————————-
|
||||
|
||||
// First, open the Continue sidebar by pressing [Cmd + L] or clicking the Continue icon.
|
||||
|
||||
/* ————————————————————————————————————————————————— Chat ————————————————————————————————————————————————— */
|
||||
// See an example at https://docs.continue.dev/getting-started/install
|
||||
|
||||
// Follow the instructions in the sidebar to set up a Chat/Edit modela and an Autocomplete model.
|
||||
|
||||
// ————————————————————————————————————————————————— Chat —————————————————————————————————————————————————
|
||||
|
||||
// Highlight the code below
|
||||
// Press [Cmd/Ctrl + J] to add to Chat
|
||||
// Press [Cmd + L] to add to Chat
|
||||
// Try asking Continue "what sorting algorithm is this?"
|
||||
function sortingAlgorithm(x: number[]): number[] {
|
||||
for (let i = 0; i < x.length; i++) {
|
||||
|
|
@ -26,10 +33,13 @@ function sortingAlgorithm(x: number[]): number[] {
|
|||
return x;
|
||||
}
|
||||
|
||||
/* ————————————————————————————————————————————————— Edit ————————————————————————————————————————————————— */
|
||||
// [Cmd + L] always starts a new chat. Now, try the same thing using [Cmd + Shift + L].
|
||||
// This will add the code into the current chat
|
||||
|
||||
// ————————————————————————————————————————————————— Edit —————————————————————————————————————————————————
|
||||
|
||||
// Highlight the code below
|
||||
// Press [Cmd/Ctrl + I] to Edit
|
||||
// Press [Cmd + I] to Edit
|
||||
// Try asking Continue to "make this more readable"
|
||||
function sortingAlgorithm2(x: number[]): number[] {
|
||||
for (let i = 0; i < x.length; i++) {
|
||||
|
|
@ -44,12 +54,13 @@ function sortingAlgorithm2(x: number[]): number[] {
|
|||
return x;
|
||||
}
|
||||
|
||||
/* ————————————————————————————————————————————— Autocomplete —————————————————————————————————————————————— */
|
||||
// ————————————————————————————————————————————— Autocomplete ——————————————————————————————————————————————
|
||||
|
||||
// Place cursor after `sortingAlgorithm...` below and press [Enter]
|
||||
// Place cursor after `sortingAlgorithm:` below and press [Enter]
|
||||
// Press [Tab] to accept the Autocomplete suggestion
|
||||
|
||||
// Basic assertion for sortingAlgorithm...
|
||||
// Basic assertion for sortingAlgorithm:
|
||||
|
||||
// —————————————————————————————————————————————- Learn More -——————————————————————————————————————————————
|
||||
|
||||
/* —————————————————— Learn more at https://docs.continue.dev/getting-started/overview ——————————————————— */
|
||||
// Visit the Continue Docs at https://docs.continue.dev/getting-started/overview
|
||||
|
|
|
|||
|
|
@ -936,7 +936,8 @@
|
|||
"gemini-1.5-flash-latest",
|
||||
"gemini-1.5-flash",
|
||||
"gemini-1.5-flash-8b",
|
||||
"gemini-2.0-flash-exp"
|
||||
"gemini-2.0-flash-exp",
|
||||
"gemini-2.0-flash"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -998,6 +999,8 @@
|
|||
"anyOf": [
|
||||
{
|
||||
"enum": [
|
||||
"deepseek-r1",
|
||||
"deepseek_v3",
|
||||
"llama3-8b",
|
||||
"llama3-70b",
|
||||
"llama3.1-8b",
|
||||
|
|
|
|||
2
extensions/vscode/package-lock.json
generated
2
extensions/vscode/package-lock.json
generated
|
|
@ -110,7 +110,7 @@
|
|||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.260",
|
||||
"version": "0.9.261",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -580,7 +580,8 @@
|
|||
{
|
||||
"type": "webview",
|
||||
"id": "continue.continueGUIView",
|
||||
"name": "",
|
||||
"name": "Continue",
|
||||
"icon": "media/sidebar-icon.png",
|
||||
"visibility": "visible"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ interface VsCodeCompletionInput {
|
|||
export class ContinueCompletionProvider
|
||||
implements vscode.InlineCompletionItemProvider {
|
||||
private onError(e: any) {
|
||||
const options = ["Documentation"];
|
||||
let options = ["Documentation"];
|
||||
if (e.message.includes("Ollama may not be installed")) {
|
||||
options.push("Download Ollama");
|
||||
} else if (e.message.includes("Ollama may not be running")) {
|
||||
options.unshift("Start Ollama"); // We want "Start" to be the default choice
|
||||
options = ["Start Ollama"]; // We want "Start" to be the only choice
|
||||
}
|
||||
|
||||
if (e.message.includes("Please sign in with GitHub")) {
|
||||
|
|
@ -61,7 +61,7 @@ export class ContinueCompletionProvider
|
|||
);
|
||||
} else if (val === "Download Ollama") {
|
||||
vscode.env.openExternal(vscode.Uri.parse("https://ollama.ai/download"));
|
||||
} else if (val == "Start Ollama") {
|
||||
} else if (val === "Start Ollama") {
|
||||
startLocalOllama(this.ide);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ export class RecentlyEditedTracker {
|
|||
private async insertRange(
|
||||
editedRange: Omit<VsCodeRecentlyEditedRange, "lines" | "symbols">,
|
||||
): Promise<void> {
|
||||
|
||||
if (editedRange.uri.scheme === "output") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for overlap with any existing ranges
|
||||
for (let i = 0; i < this.recentlyEditedRanges.length; i++) {
|
||||
let range = this.recentlyEditedRanges[i];
|
||||
|
|
@ -78,6 +83,7 @@ export class RecentlyEditedTracker {
|
|||
RecentlyEditedTracker.maxRecentlyEditedRanges,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private insertDocument(uri: vscode.Uri): void {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import { VsCodeIde } from "./VsCodeIde";
|
|||
import { getMetaKeyLabel } from "./util/util";
|
||||
|
||||
import type { VsCodeWebviewProtocol } from "./webviewProtocol";
|
||||
import { startLocalOllama } from "core/util/ollamaHelper";
|
||||
|
||||
let fullScreenPanel: vscode.WebviewPanel | undefined;
|
||||
|
||||
|
|
@ -777,6 +778,7 @@ const getCommandsMap: (
|
|||
sessionId,
|
||||
);
|
||||
}
|
||||
panel.reveal();
|
||||
sessionLoader.dispose();
|
||||
});
|
||||
|
||||
|
|
@ -1002,6 +1004,9 @@ const getCommandsMap: (
|
|||
"continue.openAccountDialog": () => {
|
||||
sidebar.webviewProtocol?.request("openDialogMessage", "account");
|
||||
},
|
||||
"continue.startLocalOllama": () => {
|
||||
startLocalOllama(ide);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,12 @@ export async function showTutorial(ide: IDE) {
|
|||
// Ensure keyboard shortcuts match OS
|
||||
if (process.platform !== "darwin") {
|
||||
let tutorialContent = await ide.readFile(tutorialUri.toString());
|
||||
tutorialContent = tutorialContent.replace("⌘", "^").replace("Cmd", "Ctrl");
|
||||
tutorialContent = tutorialContent
|
||||
.replaceAll("[Cmd + L]", "[Ctrl + L]")
|
||||
.replaceAll("[Cmd + Shift + L]", "[Ctrl + Shift + L]")
|
||||
.replaceAll("[Cmd + I]", "[Ctrl + I]")
|
||||
.replaceAll("⌘", "^");
|
||||
|
||||
await ide.writeFile(tutorialUri.toString(), tutorialContent);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import { IMessenger } from "../../../core/protocol/messenger";
|
|||
import { showFreeTrialLoginMessage } from "./util/messages";
|
||||
|
||||
export class VsCodeWebviewProtocol
|
||||
implements IMessenger<FromWebviewProtocol, ToWebviewProtocol> {
|
||||
implements IMessenger<FromWebviewProtocol, ToWebviewProtocol>
|
||||
{
|
||||
listeners = new Map<
|
||||
keyof FromWebviewProtocol,
|
||||
((message: Message) => any)[]
|
||||
|
|
@ -85,6 +86,30 @@ export class VsCodeWebviewProtocol
|
|||
respond({ done: true, content: response, status: "success" });
|
||||
}
|
||||
} catch (e: any) {
|
||||
let message = e.message;
|
||||
//Intercept Ollama errors for special handling
|
||||
if (message.includes("Ollama may not")) {
|
||||
const options = [];
|
||||
if (message.includes("be installed")) {
|
||||
options.push("Download Ollama");
|
||||
} else if (message.includes("be running")) {
|
||||
options.push("Start Ollama");
|
||||
}
|
||||
if (options.length > 0) {
|
||||
// Respond without an error, so the UI doesn't show the error component
|
||||
respond({ done: true, status: "error" });
|
||||
// Show native vscode error message instead, with options to download/start Ollama
|
||||
vscode.window.showErrorMessage(e.message, ...options).then(async (val) => {
|
||||
if (val === "Download Ollama") {
|
||||
vscode.env.openExternal(vscode.Uri.parse("https://ollama.ai/download"));
|
||||
} else if (val === "Start Ollama") {
|
||||
vscode.commands.executeCommand("continue.startLocalOllama");
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
respond({ done: true, error: e.message, status: "error" });
|
||||
|
||||
const stringified = JSON.stringify({ msg }, null, 2);
|
||||
|
|
@ -99,7 +124,6 @@ export class VsCodeWebviewProtocol
|
|||
return;
|
||||
}
|
||||
|
||||
let message = e.message;
|
||||
if (e.cause) {
|
||||
if (e.cause.name === "ConnectTimeoutError") {
|
||||
message = `Connection timed out. If you expect it to take a long time to connect, you can increase the timeout in config.json by setting "requestOptions": { "timeout": 10000 }. You can find the full config reference here: https://docs.continue.dev/reference/config`;
|
||||
|
|
@ -114,8 +138,7 @@ export class VsCodeWebviewProtocol
|
|||
message = message.split("\n").filter((l: string) => l !== "")[1];
|
||||
try {
|
||||
message = JSON.parse(message).message;
|
||||
} catch {
|
||||
}
|
||||
} catch {}
|
||||
if (message.includes("exceeded")) {
|
||||
message +=
|
||||
" To keep using Continue, you can set up a local model or use your own API key.";
|
||||
|
|
@ -152,8 +175,7 @@ export class VsCodeWebviewProtocol
|
|||
this._webviewListener = this._webview.onDidReceiveMessage(handleMessage);
|
||||
}
|
||||
|
||||
constructor(private readonly reloadConfig: () => void) {
|
||||
}
|
||||
constructor(private readonly reloadConfig: () => void) {}
|
||||
|
||||
invoke<T extends keyof FromWebviewProtocol>(
|
||||
messageType: T,
|
||||
|
|
@ -163,7 +185,7 @@ export class VsCodeWebviewProtocol
|
|||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
onError(handler: (error: Error) => void): void {
|
||||
onError(handler: (message: Message, error: Error) => void): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
|
|
|
|||
2
gui/package-lock.json
generated
2
gui/package-lock.json
generated
|
|
@ -112,7 +112,7 @@
|
|||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
gui/public/logos/siliconflow.png
Normal file
BIN
gui/public/logos/siliconflow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
|
|
@ -23,6 +23,7 @@ import { AuthProvider } from "../context/Auth";
|
|||
import { exitEditMode } from "../redux/thunks";
|
||||
import { loadLastSession, saveCurrentSession } from "../redux/thunks/session";
|
||||
import { incrementFreeTrialCount } from "../util/freeTrial";
|
||||
import OSRContextMenu from "./OSRContextMenu";
|
||||
|
||||
const LayoutTopDiv = styled(CustomScrollbarDiv)`
|
||||
height: 100%;
|
||||
|
|
@ -261,6 +262,7 @@ const Layout = () => {
|
|||
return (
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
|
|
|
|||
222
gui/src/components/OSRContextMenu.tsx
Normal file
222
gui/src/components/OSRContextMenu.tsx
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||
import useIsOSREnabled from "../hooks/useIsOSREnabled";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { getPlatform } from "../util";
|
||||
|
||||
interface Position {
|
||||
top?: number;
|
||||
left?: number;
|
||||
bottom?: number;
|
||||
right?: number;
|
||||
}
|
||||
|
||||
const OSRContextMenu = () => {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const isOSREnabled = useIsOSREnabled();
|
||||
const platform = useRef(getPlatform());
|
||||
|
||||
const [position, setPosition] = useState<Position | null>(null);
|
||||
const [canCopy, setCanCopy] = useState(false);
|
||||
const [canCut, setCanCut] = useState(false);
|
||||
const [canPaste, setCanPaste] = useState(false);
|
||||
|
||||
const menuRef = React.useRef<HTMLDivElement>(null);
|
||||
const selectedTextRef = useRef<string | null>(null);
|
||||
const selectedRangeRef = useRef<Range | null>(null);
|
||||
|
||||
function onMenuItemClick(
|
||||
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
||||
) {
|
||||
event.preventDefault();
|
||||
|
||||
// restore selection
|
||||
if (selectedRangeRef.current) {
|
||||
const selection = window.getSelection();
|
||||
selection?.removeAllRanges();
|
||||
selection?.addRange(selectedRangeRef.current);
|
||||
}
|
||||
|
||||
// Hide menu
|
||||
setPosition(null);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
function leaveWindowHandler() {
|
||||
setPosition(null);
|
||||
}
|
||||
function contextMenuHandler(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
}
|
||||
function clickHandler(event: MouseEvent) {
|
||||
// If clicked outside of menu, close menu
|
||||
if (!menuRef.current?.contains(event.target as Node)) {
|
||||
setPosition(null);
|
||||
}
|
||||
|
||||
if (event.button === 2) {
|
||||
// Prevent default context menu
|
||||
event.preventDefault();
|
||||
|
||||
selectedRangeRef.current = null;
|
||||
selectedTextRef.current = null;
|
||||
|
||||
const selection = window.getSelection();
|
||||
let isClickWithinSelection = false;
|
||||
if (selection && selection.rangeCount > 0) {
|
||||
const range = selection.getRangeAt(0);
|
||||
const selectedText = range.toString();
|
||||
selectedRangeRef.current = range.cloneRange();
|
||||
|
||||
if (selectedText.length > 0) {
|
||||
if (selectedText) {
|
||||
selectedTextRef.current = selectedText;
|
||||
const rects = range.getClientRects();
|
||||
for (let i = 0; i < rects.length; i++) {
|
||||
const rect = rects[i];
|
||||
if (
|
||||
event.clientX >= rect.left &&
|
||||
event.clientX <= rect.right &&
|
||||
event.clientY >= rect.top &&
|
||||
event.clientY <= rect.bottom
|
||||
) {
|
||||
isClickWithinSelection = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if right clicked on editable content (allows paste/cut)
|
||||
let isEditable = false;
|
||||
if (
|
||||
event.target &&
|
||||
"isContentEditable" in event.target &&
|
||||
typeof event.target.isContentEditable === "boolean"
|
||||
) {
|
||||
isEditable = event.target.isContentEditable;
|
||||
}
|
||||
|
||||
setCanCopy(!!selectedTextRef.current && isClickWithinSelection);
|
||||
setCanCut(
|
||||
!!(isEditable && selectedTextRef.current && isClickWithinSelection),
|
||||
);
|
||||
|
||||
// TODO only can paste if there is text in clipboard?
|
||||
setCanPaste(isEditable);
|
||||
// navigator.clipboard.readText().then((text) => {
|
||||
// setCanPaste(text || null);
|
||||
// });
|
||||
|
||||
// Open towards inside of window from click
|
||||
const toRight = event.clientX > window.innerWidth / 2;
|
||||
const toBottom = event.clientY > window.innerHeight / 2;
|
||||
if (toRight) {
|
||||
if (toBottom) {
|
||||
setPosition({
|
||||
bottom: window.innerHeight - event.clientY,
|
||||
right: window.innerWidth - event.clientX,
|
||||
});
|
||||
} else {
|
||||
setPosition({
|
||||
top: event.clientY,
|
||||
right: window.innerWidth - event.clientX,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (toBottom) {
|
||||
setPosition({
|
||||
bottom: window.innerHeight - event.clientY,
|
||||
left: event.clientX,
|
||||
});
|
||||
} else {
|
||||
setPosition({
|
||||
top: event.clientY,
|
||||
left: event.clientX,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setPosition(null);
|
||||
if (isOSREnabled && platform.current !== "mac") {
|
||||
document.addEventListener("mousedown", clickHandler);
|
||||
document.addEventListener("mouseleave", leaveWindowHandler);
|
||||
document.addEventListener("contextmenu", contextMenuHandler);
|
||||
}
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("mousedown", clickHandler);
|
||||
document.removeEventListener("mouseleave", leaveWindowHandler);
|
||||
document.removeEventListener("contextmenu", contextMenuHandler);
|
||||
};
|
||||
}, [isOSREnabled]);
|
||||
|
||||
if (platform.current === "mac" || !isOSREnabled || !position) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className="bg-vsc-editor-background absolute flex flex-col gap-1.5 overflow-hidden rounded-md border border-solid border-gray-500 px-3 py-1.5"
|
||||
style={{
|
||||
...position,
|
||||
zIndex: 9999,
|
||||
}}
|
||||
ref={menuRef}
|
||||
>
|
||||
{canCopy && (
|
||||
<div
|
||||
className="cursor-pointer hover:opacity-90"
|
||||
onClick={(e) => {
|
||||
onMenuItemClick(e);
|
||||
document.execCommand("copy");
|
||||
}}
|
||||
>
|
||||
Copy
|
||||
</div>
|
||||
)}
|
||||
{canCut && (
|
||||
<div
|
||||
className="cursor-pointer hover:opacity-90"
|
||||
onClick={(e) => {
|
||||
onMenuItemClick(e);
|
||||
document.execCommand("cut");
|
||||
}}
|
||||
>
|
||||
Cut
|
||||
</div>
|
||||
)}
|
||||
{/* PASTING is currently broken, can't get the clipboard text */}
|
||||
{/* {canPaste && (
|
||||
<div
|
||||
className="cursor-pointer hover:opacity-90"
|
||||
onClick={async (e) => {
|
||||
onMenuItemClick(e);
|
||||
const clipboardText = await navigator.clipboard.readText();
|
||||
// const out = await navigator.clipboard.read();
|
||||
if (clipboardText) {
|
||||
selectedRangeRef.current?.deleteContents();
|
||||
selectedRangeRef.current?.insertNode(
|
||||
document.createTextNode(clipboardText),
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Paste
|
||||
</div>
|
||||
)} */}
|
||||
<div
|
||||
className="cursor-pointer hover:opacity-90"
|
||||
onClick={(e) => {
|
||||
onMenuItemClick(e);
|
||||
ideMessenger.post("toggleDevTools", undefined);
|
||||
}}
|
||||
>
|
||||
Open Dev Tools
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default OSRContextMenu;
|
||||
|
|
@ -5,6 +5,7 @@ import styled from "styled-components";
|
|||
import { CloseButton, defaultBorderRadius, vscInputBackground } from "../";
|
||||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
import { useOnboardingCard } from "./hooks/useOnboardingCard";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
|
||||
const StyledCard = styled.div`
|
||||
margin: auto;
|
||||
|
|
@ -26,6 +27,7 @@ interface OnboardingCardProps {
|
|||
|
||||
export function OnboardingCard({ isDialog }: OnboardingCardProps) {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
|
||||
function renderTabContent() {
|
||||
switch (onboardingCard.activeTab) {
|
||||
|
|
@ -53,7 +55,7 @@ export function OnboardingCard({ isDialog }: OnboardingCardProps) {
|
|||
activeTab={onboardingCard.activeTab || "Best"}
|
||||
onTabClick={onboardingCard.setActiveTab}
|
||||
/>
|
||||
{!isDialog && (
|
||||
{!isDialog && !!config.models.length && (
|
||||
<CloseButton onClick={() => onboardingCard.close()}>
|
||||
<XMarkIcon className="mt-1.5 hidden h-5 w-5 hover:brightness-125 sm:flex" />
|
||||
</CloseButton>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { CubeIcon } from "@heroicons/react/24/outline";
|
||||
import { DEFAULT_CHAT_MODEL_CONFIG } from "core/config/default";
|
||||
import { FormEventHandler, useContext, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Button, Input, InputSubtext, lightGray } from "../..";
|
||||
|
|
@ -57,9 +56,6 @@ function BestExperienceConfigForm({
|
|||
apiKey: autocompleteApiKey,
|
||||
};
|
||||
|
||||
ideMessenger.post("config/deleteModel", {
|
||||
title: DEFAULT_CHAT_MODEL_CONFIG.title,
|
||||
});
|
||||
ideMessenger.post("config/addModel", { model: chatModelConfig });
|
||||
ideMessenger.post("config/addModel", {
|
||||
model: repoMapConfig,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { TabTitle } from "../components/OnboardingCardTabs";
|
|||
import { useOnboardingCard } from "../hooks";
|
||||
import OnboardingLocalTab from "../tabs/OnboardingLocalTab";
|
||||
import MainTab from "./tabs/main";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
|
||||
const StyledCard = styled.div`
|
||||
margin: auto;
|
||||
|
|
@ -29,6 +30,7 @@ interface OnboardingCardProps {
|
|||
|
||||
export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
|
||||
if (getLocalStorage("onboardingStatus") === undefined) {
|
||||
setLocalStorage("onboardingStatus", "Started");
|
||||
|
|
@ -38,7 +40,7 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
|||
|
||||
return (
|
||||
<StyledCard className="xs:py-4 xs:px-4 relative px-2 py-3">
|
||||
{!isDialog && (
|
||||
{!isDialog && !!config.models.length && (
|
||||
<CloseButton onClick={() => onboardingCard.close()}>
|
||||
<XMarkIcon className="mt-1.5 hidden h-5 w-5 hover:brightness-125 sm:flex" />
|
||||
</CloseButton>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { KeyboardEvent } from "react";
|
|||
import { getPlatform, isWebEnvironment } from "../../util";
|
||||
|
||||
const isWebEnv = isWebEnvironment();
|
||||
const platform = getPlatform();
|
||||
|
||||
/**
|
||||
* This handles various keypress issues when OSR is enabled
|
||||
|
|
@ -14,6 +13,7 @@ export const handleJetBrainsOSRMetaKeyIssues = (
|
|||
) => {
|
||||
const selection = window.getSelection();
|
||||
const alter = e.shiftKey ? "extend" : "move";
|
||||
const platform = getPlatform();
|
||||
|
||||
const handlers: Record<string, () => void> = {
|
||||
Backspace: () => handleJetBrainsMetaBackspace(editor),
|
||||
|
|
@ -108,6 +108,7 @@ export const handleJetBrainsMetaBackspace = (editor: Editor) => {
|
|||
}
|
||||
|
||||
// For Linux/Windows, only delete the word to the left of the cursor
|
||||
const platform = getPlatform();
|
||||
if (platform !== "mac") {
|
||||
deleteSingleWord(editor);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ export default function StepContainerPreActionButtons({
|
|||
tabIndex={-1}
|
||||
onMouseEnter={() => setHovering(true)}
|
||||
onMouseLeave={() => setHovering(false)}
|
||||
className="bg-vsc-editor-background border-vsc-input-border relative rounded-md border-[1px] border-solid"
|
||||
className="bg-vsc-editor-background border-vsc-input-border relative my-2.5 rounded-md border-[1px] border-solid"
|
||||
>
|
||||
<div className="h-full w-full overflow-hidden rounded-md">{children}</div>
|
||||
{hovering && !isStreaming && (
|
||||
|
|
|
|||
|
|
@ -37,6 +37,60 @@ export interface ModelPackage {
|
|||
}
|
||||
|
||||
export const models: { [key: string]: ModelPackage } = {
|
||||
deepseekV3Chat: {
|
||||
title: "deepseek v3",
|
||||
description: "A model from deekseek for chat",
|
||||
refUrl: "",
|
||||
params: {
|
||||
title: "deepseek_v3",
|
||||
model: "deepseek/deepseek_v3",
|
||||
contextLength: 2048,
|
||||
},
|
||||
icon: "deepseek.png",
|
||||
dimensions: [
|
||||
{
|
||||
name: "Parameter Count",
|
||||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"r1": {
|
||||
model: "deepseek/deepseek_v3",
|
||||
title: "deepseek_v3",
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
providerOptions: [
|
||||
"novita"
|
||||
],
|
||||
isOpenSource: true,
|
||||
},
|
||||
deepseekR1Chat: {
|
||||
title: "deepseek r1",
|
||||
description: "A model from deekseek for chat",
|
||||
refUrl: "",
|
||||
params: {
|
||||
title: "deepseek-r1",
|
||||
model: "deepseek/deepseek-r1",
|
||||
contextLength: 2048,
|
||||
},
|
||||
icon: "deepseek.png",
|
||||
dimensions: [
|
||||
{
|
||||
name: "Parameter Count",
|
||||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"r1": {
|
||||
model: "deepseek/deepseek-r1",
|
||||
title: "deepseek-r1",
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
providerOptions: [
|
||||
"novita"
|
||||
],
|
||||
isOpenSource: true,
|
||||
},
|
||||
llama318BChat: {
|
||||
title: "Llama 3.1 8B",
|
||||
description: "A model from Meta, fine-tuned for chat",
|
||||
|
|
|
|||
|
|
@ -427,7 +427,8 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
|
|||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
packages: [models.llama318BChat, models.mistralChat].map((p) => {
|
||||
packages: [models.llama318BChat, models.mistralChat,
|
||||
models.deepseekR1Chat, models.deepseekV3Chat].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
|
|
@ -785,7 +786,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
|
|||
askSage: {
|
||||
title: "Ask Sage",
|
||||
provider: "askSage",
|
||||
icon: "ask-Sage.png",
|
||||
icon: "ask-sage.png",
|
||||
description:
|
||||
"The Ask Sage API provides seamless access to LLMs including OpenAI, Anthropic, Meta, Mistral, and more.",
|
||||
longDescription: `To get access to the Ask Sage API, obtain your API key from the [Ask Sage platform](https://chat.asksage.ai/) for all other models.`,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
|
|||
typeof error["message"] === "string"
|
||||
) {
|
||||
message = error["message"];
|
||||
const status = message?.split(" ")[0];
|
||||
const parts = message?.split(" ") ?? [];
|
||||
const status = parts[0] === "HTTP" ? parts[1] : parts[0];
|
||||
if (status) {
|
||||
const code = Number(status);
|
||||
if (!Number.isNaN(statusCode)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue