🐛 merge fixes
This commit is contained in:
parent
3355d18617
commit
78cb6a2dc2
14 changed files with 241 additions and 1893 deletions
|
|
@ -234,7 +234,7 @@ const EditSlashCommand: SlashCommand = {
|
|||
}
|
||||
|
||||
// Strip unecessary parts of the input (the fact that you have to do this is suboptimal, should be refactored away)
|
||||
const content = history[history.length - 1].content;
|
||||
let content = history[history.length - 1].content;
|
||||
if (typeof content !== "string") {
|
||||
content.forEach((part) => {
|
||||
if (part.text?.startsWith("/edit")) {
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ export class ConfigHandler {
|
|||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettings: IdeSettings,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly writeLog: (text: string) => Promise<void>,
|
||||
private readonly onConfigUpdate: () => void,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettings = ideSettings;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.writeLog = writeLog;
|
||||
this.onConfigUpdate = onConfigUpdate;
|
||||
try {
|
||||
|
|
@ -31,7 +31,7 @@ export class ConfigHandler {
|
|||
}
|
||||
|
||||
updateIdeSettings(ideSettings: IdeSettings) {
|
||||
this.ideSettings = ideSettings;
|
||||
this.ideSettingsPromise = Promise.resolve(ideSettings);
|
||||
this.reloadConfig();
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ export class ConfigHandler {
|
|||
this.savedConfig = await loadFullConfigNode(
|
||||
this.ide.readFile.bind(this.ide),
|
||||
workspaceConfigs,
|
||||
this.ideSettings,
|
||||
await this.ideSettingsPromise,
|
||||
ideInfo.ideType,
|
||||
uniqueId,
|
||||
this.writeLog,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export interface EmbeddingsCacheResponse<T extends ArtifactType> {
|
|||
export interface IContinueServerClient {
|
||||
connected: boolean;
|
||||
url: URL | undefined;
|
||||
getUserToken(): Promise<string | undefined>;
|
||||
getUserToken(): string | undefined;
|
||||
getConfig(): Promise<{ configJson: string; configJs: string }>;
|
||||
getFromIndexCache<T extends ArtifactType>(
|
||||
keys: string[],
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export class ContinueServerClient implements IContinueServerClient {
|
|||
|
||||
constructor(
|
||||
serverUrl: string | undefined,
|
||||
private readonly userToken: Promise<string | undefined>,
|
||||
private readonly userToken: string | undefined,
|
||||
) {
|
||||
try {
|
||||
this.url =
|
||||
|
|
@ -22,7 +22,7 @@ export class ContinueServerClient implements IContinueServerClient {
|
|||
}
|
||||
}
|
||||
|
||||
getUserToken(): Promise<string | undefined> {
|
||||
getUserToken(): string | undefined {
|
||||
return this.userToken;
|
||||
}
|
||||
|
||||
|
|
|
|||
32
core/core.ts
32
core/core.ts
|
|
@ -8,6 +8,7 @@ import {
|
|||
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";
|
||||
|
|
@ -27,6 +28,7 @@ export class Core {
|
|||
configHandler: ConfigHandler;
|
||||
codebaseIndexerPromise: Promise<CodebaseIndexer>;
|
||||
completionProvider: CompletionProvider;
|
||||
continueServerClientPromise: Promise<ContinueServerClient>;
|
||||
|
||||
private abortedMessageIds: Set<string> = new Set();
|
||||
|
||||
|
|
@ -61,19 +63,33 @@ export class Core {
|
|||
(() => this.messenger.send("configUpdate", undefined)).bind(this),
|
||||
);
|
||||
|
||||
// Codebase Indexer
|
||||
// Codebase Indexer and ContinueServerClient depend on IdeSettings
|
||||
const indexingPauseToken = new PauseToken(
|
||||
new GlobalContext().get("indexingPaused") === true,
|
||||
);
|
||||
this.codebaseIndexerPromise = new Promise(async (resolve) => {
|
||||
const ideSettings = await ideSettingsPromise;
|
||||
resolve(
|
||||
let codebaseIndexerResolve: (_: any) => void | undefined;
|
||||
this.codebaseIndexerPromise = new Promise(
|
||||
async (resolve) => (codebaseIndexerResolve = resolve),
|
||||
);
|
||||
|
||||
let continueServerClientResolve: (_: any) => void | undefined;
|
||||
this.continueServerClientPromise = new Promise(
|
||||
(resolve) => (continueServerClientResolve = resolve),
|
||||
);
|
||||
|
||||
ideSettingsPromise.then((ideSettings) => {
|
||||
const continueServerClient = new ContinueServerClient(
|
||||
ideSettings.remoteConfigServerUrl,
|
||||
ideSettings.userToken,
|
||||
);
|
||||
continueServerClientResolve(continueServerClient);
|
||||
|
||||
codebaseIndexerResolve(
|
||||
new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
new PauseToken(false),
|
||||
ideSettings.remoteConfigServerUrl,
|
||||
ideSettings.userToken,
|
||||
continueServerClient,
|
||||
),
|
||||
);
|
||||
this.ide
|
||||
|
|
@ -446,8 +462,8 @@ export class Core {
|
|||
mode === "local"
|
||||
? setupLocalMode
|
||||
: mode === "optimized"
|
||||
? setupOptimizedMode
|
||||
: setupOptimizedExistingUserMode,
|
||||
? setupOptimizedMode
|
||||
: setupOptimizedExistingUserMode,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
LLMOptions,
|
||||
ModelDescription,
|
||||
} from "../../index.js";
|
||||
import { IdeSettings } from "../../protocol.js";
|
||||
import { IdeSettings } from "../../protocol/ideWebview.js";
|
||||
import { DEFAULT_MAX_TOKENS } from "../constants.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
import Anthropic from "./Anthropic.js";
|
||||
|
|
|
|||
91
core/pnpm-lock.yaml
generated
91
core/pnpm-lock.yaml
generated
|
|
@ -126,6 +126,9 @@ importers:
|
|||
specifier: ^0.21.0
|
||||
version: 0.21.0
|
||||
devDependencies:
|
||||
'@biomejs/biome':
|
||||
specifier: 1.6.4
|
||||
version: 1.6.4
|
||||
'@types/follow-redirects':
|
||||
specifier: ^1.14.4
|
||||
version: 1.14.4
|
||||
|
|
@ -346,6 +349,59 @@ packages:
|
|||
'@bcoe/v8-coverage@0.2.3':
|
||||
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
|
||||
|
||||
'@biomejs/biome@1.6.4':
|
||||
resolution: {integrity: sha512-3groVd2oWsLC0ZU+XXgHSNbq31lUcOCBkCcA7sAQGBopHcmL+jmmdoWlY3S61zIh+f2mqQTQte1g6PZKb3JJjA==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
hasBin: true
|
||||
|
||||
'@biomejs/cli-darwin-arm64@1.6.4':
|
||||
resolution: {integrity: sha512-2WZef8byI9NRzGajGj5RTrroW9BxtfbP9etigW1QGAtwu/6+cLkdPOWRAs7uFtaxBNiKFYA8j/BxV5zeAo5QOQ==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@biomejs/cli-darwin-x64@1.6.4':
|
||||
resolution: {integrity: sha512-uo1zgM7jvzcoDpF6dbGizejDLCqNpUIRkCj/oEK0PB0NUw8re/cn1EnxuOLZqDpn+8G75COLQTOx8UQIBBN/Kg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@biomejs/cli-linux-arm64-musl@1.6.4':
|
||||
resolution: {integrity: sha512-Hp8Jwt6rjj0wCcYAEN6/cfwrrPLLlGOXZ56Lei4Pt4jy39+UuPeAVFPeclrrCfxyL1wQ2xPrhd/saTHSL6DoJg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-arm64@1.6.4':
|
||||
resolution: {integrity: sha512-wAOieaMNIpLrxGc2/xNvM//CIZg7ueWy3V5A4T7gDZ3OL/Go27EKE59a+vMKsBCYmTt7jFl4yHz0TUkUbodA/w==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@1.6.4':
|
||||
resolution: {integrity: sha512-wqi0hr8KAx5kBO0B+m5u8QqiYFFBJOSJVSuRqTeGWW+GYLVUtXNidykNqf1JsW6jJDpbkSp2xHKE/bTlVaG2Kg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-x64@1.6.4':
|
||||
resolution: {integrity: sha512-qTWhuIw+/ePvOkjE9Zxf5OqSCYxtAvcTJtVmZT8YQnmY2I62JKNV2m7tf6O5ViKZUOP0mOQ6NgqHKcHH1eT8jw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-win32-arm64@1.6.4':
|
||||
resolution: {integrity: sha512-Wp3FiEeF6v6C5qMfLkHwf4YsoNHr/n0efvoC8jCKO/kX05OXaVExj+1uVQ1eGT7Pvx0XVm/TLprRO0vq/V6UzA==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@biomejs/cli-win32-x64@1.6.4':
|
||||
resolution: {integrity: sha512-mz183Di5hTSGP7KjNWEhivcP1wnHLGmOxEROvoFsIxMYtDhzJDad4k5gI/1JbmA0xe4n52vsgqo09tBhrMT/Zg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@esbuild/aix-ppc64@0.19.12':
|
||||
resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==}
|
||||
engines: {node: '>=12'}
|
||||
|
|
@ -3845,6 +3901,41 @@ snapshots:
|
|||
|
||||
'@bcoe/v8-coverage@0.2.3': {}
|
||||
|
||||
'@biomejs/biome@1.6.4':
|
||||
optionalDependencies:
|
||||
'@biomejs/cli-darwin-arm64': 1.6.4
|
||||
'@biomejs/cli-darwin-x64': 1.6.4
|
||||
'@biomejs/cli-linux-arm64': 1.6.4
|
||||
'@biomejs/cli-linux-arm64-musl': 1.6.4
|
||||
'@biomejs/cli-linux-x64': 1.6.4
|
||||
'@biomejs/cli-linux-x64-musl': 1.6.4
|
||||
'@biomejs/cli-win32-arm64': 1.6.4
|
||||
'@biomejs/cli-win32-x64': 1.6.4
|
||||
|
||||
'@biomejs/cli-darwin-arm64@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-darwin-x64@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-arm64-musl@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-arm64@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-x64@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-win32-arm64@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-win32-x64@1.6.4':
|
||||
optional: true
|
||||
|
||||
'@esbuild/aix-ppc64@0.19.12':
|
||||
optional: true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { IndexingProgressUpdate } from "..";
|
||||
|
||||
export type ToWebviewFromIdeOrCoreProtocol = {
|
||||
configUpdate: [undefined, void];
|
||||
getDefaultModelTitle: [undefined, string];
|
||||
indexProgress: [{ progress: number; desc: string }, void];
|
||||
indexProgress: [IndexingProgressUpdate, void];
|
||||
refreshSubmenuItems: [undefined, void];
|
||||
};
|
||||
|
|
|
|||
1919
extensions/vscode/pnpm-lock.yaml
generated
1919
extensions/vscode/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,11 @@
|
|||
import { ConfigHandler } from "core/config/handler";
|
||||
import { ContinueServerClient } from "core/continueServer/stubs/client";
|
||||
import { getConfigJsonPath, getConfigTsPath } from "core/util/paths";
|
||||
import { ConfigHandler } from "core/config/handler.js";
|
||||
import { Core } from "core/core";
|
||||
import { FromCoreProtocol, ToCoreProtocol } from "core/protocol/index.js";
|
||||
import { InProcessMessenger } from "core/util/messenger.js";
|
||||
import { getConfigJsonPath, getConfigTsPath } from "core/util/paths.js";
|
||||
import fs from "fs";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import * as vscode from "vscode";
|
||||
import { Core } from "../../../../core/core";
|
||||
import { FromCoreProtocol, ToCoreProtocol } from "../../../../core/protocol";
|
||||
import { InProcessMessenger } from "../../../../core/util/messenger";
|
||||
import { ContinueCompletionProvider } from "../autocomplete/completionProvider";
|
||||
import { setupStatusBar } from "../autocomplete/statusBar";
|
||||
import { registerAllCommands } from "../commands";
|
||||
|
|
@ -41,27 +40,7 @@ export class VsCodeExtension {
|
|||
this.ide = new VsCodeIde(this.diffManager);
|
||||
|
||||
const ideSettings = this.ide.getIdeSettings();
|
||||
const { remoteConfigServerUrl, remoteConfigSyncPeriod } = ideSettings;
|
||||
|
||||
const userTokenPromise: Promise<string | undefined> = new Promise(
|
||||
async (resolve) => {
|
||||
if (
|
||||
remoteConfigServerUrl === null ||
|
||||
remoteConfigServerUrl === undefined ||
|
||||
remoteConfigServerUrl.trim() === ""
|
||||
) {
|
||||
resolve(undefined);
|
||||
return;
|
||||
}
|
||||
const token = await getUserToken();
|
||||
resolve(token);
|
||||
},
|
||||
);
|
||||
|
||||
const continueServerClient = new ContinueServerClient(
|
||||
ideSettings.remoteConfigServerUrl,
|
||||
userTokenPromise,
|
||||
);
|
||||
const { remoteConfigServerUrl } = ideSettings;
|
||||
|
||||
// Config Handler with output channel
|
||||
const outputChannel = vscode.window.createOutputChannel(
|
||||
|
|
@ -69,7 +48,7 @@ export class VsCodeExtension {
|
|||
);
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettings,
|
||||
Promise.resolve(ideSettings),
|
||||
async (log: string) => {
|
||||
outputChannel.appendLine(
|
||||
"==========================================================================",
|
||||
|
|
@ -118,21 +97,6 @@ export class VsCodeExtension {
|
|||
// Indexing + pause token
|
||||
this.diffManager.webviewProtocol = this.webviewProtocol;
|
||||
|
||||
const userTokenPromise: Promise<string | undefined> = new Promise(
|
||||
async (resolve) => {
|
||||
if (
|
||||
remoteConfigServerUrl === null ||
|
||||
remoteConfigServerUrl === undefined ||
|
||||
remoteConfigServerUrl.trim() === ""
|
||||
) {
|
||||
resolve(undefined);
|
||||
return;
|
||||
}
|
||||
const token = await getUserToken();
|
||||
resolve(token);
|
||||
},
|
||||
);
|
||||
|
||||
const inProcessMessenger = new InProcessMessenger<
|
||||
ToCoreProtocol,
|
||||
FromCoreProtocol
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import {
|
|||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { RootState } from "../../redux/store";
|
||||
import { getFontSize } from "../../util";
|
||||
import { postToIde } from "../../util/ide";
|
||||
import HeaderButtonWithText from "../HeaderButtonWithText";
|
||||
import { CopyButton } from "../markdown/CopyButton";
|
||||
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
|
||||
|
|
@ -76,7 +75,7 @@ function StepContainer(props: StepContainerProps) {
|
|||
setFeedback(feedback);
|
||||
if (props.item.promptLogs?.length) {
|
||||
for (const promptLog of props.item.promptLogs) {
|
||||
postToIde("devdata/log", {
|
||||
ideMessenger.post("devdata/log", {
|
||||
tableName: "chat",
|
||||
data: { ...promptLog, feedback },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import {
|
|||
setEditingContextItemAtIndex,
|
||||
} from "../../redux/slices/stateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
import { isMetaEquivalentKeyPressed } from "../../util";
|
||||
import { isJetBrains } from "../../util/ide";
|
||||
import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import CodeBlockExtension from "./CodeBlockExtension";
|
||||
import { SlashCommand } from "./CommandsExtension";
|
||||
import InputToolbar from "./InputToolbar";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
ChatMessage,
|
||||
IDE,
|
||||
LLMFullCompletionOptions,
|
||||
LLMReturnValue,
|
||||
} from "core";
|
||||
import { ChatMessage, IDE, LLMFullCompletionOptions, PromptLog } from "core";
|
||||
import type { FromWebviewProtocol, ToWebviewProtocol } from "core/protocol";
|
||||
import { MessageIde } from "core/util/messageIde";
|
||||
import { Message } from "core/util/messenger";
|
||||
|
|
@ -50,7 +45,7 @@ export interface IIdeMessenger {
|
|||
cancelToken: AbortSignal | undefined,
|
||||
messages: ChatMessage[],
|
||||
options?: LLMFullCompletionOptions,
|
||||
): AsyncGenerator<ChatMessage, LLMReturnValue, unknown>;
|
||||
): AsyncGenerator<ChatMessage, PromptLog, unknown>;
|
||||
|
||||
ide: IDE;
|
||||
}
|
||||
|
|
@ -209,7 +204,7 @@ export class IdeMessenger implements IIdeMessenger {
|
|||
cancelToken: AbortSignal | undefined,
|
||||
messages: ChatMessage[],
|
||||
options: LLMFullCompletionOptions = {},
|
||||
): AsyncGenerator<ChatMessage, LLMReturnValue> {
|
||||
): AsyncGenerator<ChatMessage, PromptLog> {
|
||||
const gen = this.streamRequest(
|
||||
"llm/streamChat",
|
||||
{
|
||||
|
|
@ -233,6 +228,7 @@ export class IdeMessenger implements IIdeMessenger {
|
|||
return {
|
||||
prompt: next.value.content?.prompt,
|
||||
completion: next.value.content?.completion,
|
||||
completionOptions: next.value.content?.completionOptions,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { ToWebviewProtocol } from "core/protocol";
|
||||
import type { ToWebviewProtocol } from "core/protocol/index.js";
|
||||
import { Message } from "core/util/messenger";
|
||||
import { useContext, useEffect } from "react";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue