merge main
This commit is contained in:
commit
e5e403e47c
108 changed files with 3029 additions and 1475 deletions
25
.github/workflows/submit-github-dependency-graph.yml
vendored
Normal file
25
.github/workflows/submit-github-dependency-graph.yml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
name: Submit Gradle Dependency Graph For Dependabot
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dependency-submission:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Generate and submit dependency graph
|
||||
uses: gradle/actions/dependency-submission@v4
|
||||
with:
|
||||
# The gradle project is not in the root of the repository.
|
||||
build-root-directory: extensions/intellij
|
||||
100
.github/workflows/ts-check.yaml
vendored
100
.github/workflows/ts-check.yaml
vendored
|
|
@ -1,100 +0,0 @@
|
|||
name: TypeScript Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
tsc-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# 1. Check-out repository
|
||||
- name: Check-out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# 2. Install npm dependencies
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Cache root node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
- name: Cache extension node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: extensions/vscode/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }}
|
||||
|
||||
- name: Cache core node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: core/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }}
|
||||
|
||||
- name: Cache gui node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: gui/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
|
||||
|
||||
- name: Cache binary node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: binary/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}
|
||||
|
||||
- name: Install Root Dependencies
|
||||
run: |
|
||||
npm ci
|
||||
|
||||
- name: Install extension Dependencies
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npm ci
|
||||
env:
|
||||
# https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333
|
||||
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
|
||||
|
||||
- name: Install gui Dependencies
|
||||
run: |
|
||||
cd gui
|
||||
npm ci
|
||||
|
||||
- name: Install Core Dependencies
|
||||
run: |
|
||||
cd core
|
||||
npm ci
|
||||
|
||||
- name: Install Binary Dependencies
|
||||
run: |
|
||||
cd binary
|
||||
npm ci
|
||||
|
||||
- name: tsc core
|
||||
run: |
|
||||
cd core
|
||||
npx tsc --noEmit
|
||||
npm run lint
|
||||
|
||||
- name: tsc extensions/vscode
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npx tsc --noEmit
|
||||
npm run lint
|
||||
|
||||
- name: tsc binary
|
||||
run: |
|
||||
cd binary
|
||||
npx tsc --noEmit
|
||||
|
||||
- name: tsc gui
|
||||
run: |
|
||||
cd gui
|
||||
npx tsc --noEmit
|
||||
|
|
@ -1 +0,0 @@
|
|||
npx prettier --write .
|
||||
|
|
@ -5,17 +5,16 @@ import OpenAI from "../llm/llms/OpenAI.js";
|
|||
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../util/parameters.js";
|
||||
|
||||
import { shouldCompleteMultiline } from "./classification/shouldCompleteMultiline.js";
|
||||
import { AutocompleteLanguageInfo } from "./constants/AutocompleteLanguageInfo.js";
|
||||
import { aggregateSnippets } from "./aggregateSnippets";
|
||||
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
|
||||
// @prettier-ignore
|
||||
|
||||
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
|
||||
import { AutocompleteSnippet } from "./context/ranking/index.js";
|
||||
import { BracketMatchingService } from "./filtering/BracketMatchingService.js";
|
||||
import { CompletionStreamer } from "./generation/CompletionStreamer.js";
|
||||
import { postprocessCompletion } from "./postprocessing/index.js";
|
||||
import { shouldPrefilter } from "./prefiltering/index.js";
|
||||
import { getAllSnippets } from "./snippets/index.js";
|
||||
import { renderPrompt } from "./templating/index.js";
|
||||
import { GetLspDefinitionsFunction } from "./types.js";
|
||||
import { AutocompleteDebouncer } from "./util/AutocompleteDebouncer.js";
|
||||
import { AutocompleteLoggingService } from "./util/AutocompleteLoggingService.js";
|
||||
import AutocompleteLruCache from "./util/AutocompleteLruCache.js";
|
||||
|
|
@ -32,14 +31,6 @@ const ERRORS_TO_IGNORE = [
|
|||
"operation was aborted",
|
||||
];
|
||||
|
||||
export type GetLspDefinitionsFunction = (
|
||||
filepath: string,
|
||||
contents: string,
|
||||
cursorIndex: number,
|
||||
ide: IDE,
|
||||
lang: AutocompleteLanguageInfo,
|
||||
) => Promise<AutocompleteSnippet[]>;
|
||||
|
||||
export class CompletionProvider {
|
||||
private autocompleteCache = AutocompleteLruCache.get();
|
||||
public errorsShown: Set<string> = new Set();
|
||||
|
|
@ -171,28 +162,18 @@ export class CompletionProvider {
|
|||
token = controller.signal;
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
// Some IDEs might have special ways of finding snippets (e.g. JetBrains and VS Code have different "LSP-equivalent" systems,
|
||||
// or they might separately track recently edited ranges)
|
||||
const extraSnippets = await this._getExtraSnippets(helper);
|
||||
|
||||
const [snippets, diff, clipboardContent, workspaceDirs] =
|
||||
await Promise.all([
|
||||
aggregateSnippets(
|
||||
helper,
|
||||
extraSnippets,
|
||||
this.contextRetrievalService,
|
||||
),
|
||||
this.ide.getDiff(true),
|
||||
this.ide.getClipboardContent(),
|
||||
this.ide.getWorkspaceDirs(),
|
||||
]);
|
||||
const [snippetPayload, workspaceDirs] = await Promise.all([
|
||||
getAllSnippets({
|
||||
helper,
|
||||
ide: this.ide,
|
||||
getDefinitionsFromLsp: this.getDefinitionsFromLsp,
|
||||
contextRetrievalService: this.contextRetrievalService,
|
||||
}),
|
||||
this.ide.getWorkspaceDirs(),
|
||||
]);
|
||||
|
||||
const { prompt, prefix, suffix, completionOptions } = renderPrompt({
|
||||
snippets,
|
||||
diff,
|
||||
clipboardContent,
|
||||
snippetPayload,
|
||||
workspaceDirs,
|
||||
helper,
|
||||
});
|
||||
|
|
@ -271,7 +252,7 @@ export class CompletionProvider {
|
|||
//////////
|
||||
|
||||
// Save to cache
|
||||
if (!outcome.cacheHit) {
|
||||
if (!outcome.cacheHit && helper.options.useCache) {
|
||||
(await this.autocompleteCache).put(outcome.prefix, outcome.completion);
|
||||
}
|
||||
|
||||
|
|
@ -288,32 +269,4 @@ export class CompletionProvider {
|
|||
this.loggingService.deleteAbortController(input.completionId);
|
||||
}
|
||||
}
|
||||
|
||||
private async _getExtraSnippets(
|
||||
helper: HelperVars,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
let extraSnippets = helper.options.useOtherFiles
|
||||
? ((await Promise.race([
|
||||
this.getDefinitionsFromLsp(
|
||||
helper.input.filepath,
|
||||
helper.fullPrefix + helper.fullSuffix,
|
||||
helper.fullPrefix.length,
|
||||
this.ide,
|
||||
helper.lang,
|
||||
),
|
||||
new Promise((resolve) => {
|
||||
setTimeout(() => resolve([]), 100);
|
||||
}),
|
||||
])) as AutocompleteSnippet[])
|
||||
: [];
|
||||
|
||||
const workspaceDirs = await this.ide.getWorkspaceDirs();
|
||||
if (helper.options.onlyMyCode) {
|
||||
extraSnippets = extraSnippets.filter((snippet) => {
|
||||
return workspaceDirs.some((dir) => snippet.filepath.startsWith(dir));
|
||||
});
|
||||
}
|
||||
|
||||
return extraSnippets;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ This is just another object like the ones in the `"models"` array of `config.jso
|
|||
|
||||
This object allows you to customize the behavior of tab-autocomplete. The available options are:
|
||||
|
||||
- `useCopyBuffer`: Determines whether the copy buffer will be considered when constructing the prompt. (Boolean)
|
||||
- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean)
|
||||
- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number)
|
||||
- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number)
|
||||
|
|
@ -107,7 +106,6 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
"apiBase": "https://<my endpoint>"
|
||||
},
|
||||
"tabAutocompleteOptions": {
|
||||
"useCopyBuffer": false,
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
|
||||
import {
|
||||
fillPromptWithSnippets,
|
||||
rankAndOrderSnippets,
|
||||
type AutocompleteSnippet,
|
||||
} from "./context/ranking/index.js";
|
||||
import { HelperVars } from "./util/HelperVars.js";
|
||||
|
||||
function filterSnippetsAlreadyInCaretWindow(
|
||||
snippets: AutocompleteSnippet[],
|
||||
caretWindow: string,
|
||||
): AutocompleteSnippet[] {
|
||||
return snippets
|
||||
.map((snippet) => ({ ...snippet }))
|
||||
.filter(
|
||||
(s) =>
|
||||
s.contents.trim() !== "" && !caretWindow.includes(s.contents.trim()),
|
||||
);
|
||||
}
|
||||
|
||||
export async function aggregateSnippets(
|
||||
helper: HelperVars,
|
||||
extraSnippets: AutocompleteSnippet[],
|
||||
contextRetrievalService: ContextRetrievalService,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
let snippets = await contextRetrievalService.retrieveCandidateSnippets(
|
||||
helper,
|
||||
extraSnippets,
|
||||
);
|
||||
|
||||
snippets = filterSnippetsAlreadyInCaretWindow(
|
||||
snippets,
|
||||
helper.prunedCaretWindow,
|
||||
);
|
||||
|
||||
const scoredSnippets = rankAndOrderSnippets(snippets, helper);
|
||||
|
||||
const finalSnippets = fillPromptWithSnippets(
|
||||
scoredSnippets,
|
||||
helper.maxSnippetTokens,
|
||||
helper.modelName,
|
||||
);
|
||||
|
||||
return finalSnippets;
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
import { IDE } from "../..";
|
||||
import {
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "../snippets/types";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
import { RecentlyEditedRange } from "../util/types";
|
||||
|
||||
import { ImportDefinitionsService } from "./ImportDefinitionsService";
|
||||
import { AutocompleteSnippet, getSymbolsForSnippet } from "./ranking";
|
||||
import { getSymbolsForSnippet } from "./ranking";
|
||||
import { RootPathContextService } from "./root-path-context/RootPathContextService";
|
||||
|
||||
export class ContextRetrievalService {
|
||||
|
|
@ -18,79 +21,14 @@ export class ContextRetrievalService {
|
|||
);
|
||||
}
|
||||
|
||||
public async retrieveCandidateSnippets(
|
||||
public async getSnippetsFromImportDefinitions(
|
||||
helper: HelperVars,
|
||||
extraSnippets: AutocompleteSnippet[],
|
||||
) {
|
||||
if (helper.options.useOtherFiles === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let snippets: AutocompleteSnippet[] = [];
|
||||
|
||||
// Snippets injected by the IDE for IDE-specific reasons
|
||||
snippets.push(...extraSnippets);
|
||||
|
||||
// If a recently edited range has a line that is a perfect match with the start of the current line
|
||||
snippets.push(...this.getSnippetsFromRecentlyEditedRanges(helper));
|
||||
|
||||
// Import definitions of any symbols in near range of the caret
|
||||
snippets.push(...(await this.getSnippetsFromImportDefinitions(helper)));
|
||||
|
||||
// Root path context https://blog.continue.dev/root-path-context-the-secret-ingredient-in-continues-autocomplete-prompt/
|
||||
if (helper.options.useRootPathContext && helper.treePath) {
|
||||
snippets.push(
|
||||
...(await this.rootPathContextService.getContextForPath(
|
||||
helper.filepath,
|
||||
helper.treePath,
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
return snippets;
|
||||
}
|
||||
|
||||
private getSnippetsFromRecentlyEditedRanges(
|
||||
helper: HelperVars,
|
||||
): AutocompleteSnippet[] {
|
||||
if (helper.options.useRecentlyEdited === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const currentLinePrefix = helper.prunedPrefix
|
||||
.trim()
|
||||
.split("\n")
|
||||
.slice(-1)[0];
|
||||
if (
|
||||
currentLinePrefix?.length > helper.options.recentLinePrefixMatchMinLength
|
||||
) {
|
||||
const matchingRange = this.findMatchingRange(
|
||||
helper.input.recentlyEditedRanges,
|
||||
currentLinePrefix,
|
||||
);
|
||||
|
||||
if (matchingRange) {
|
||||
return [
|
||||
{
|
||||
...matchingRange,
|
||||
contents: matchingRange.lines.join("\n"),
|
||||
score: 0.8,
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
private async getSnippetsFromImportDefinitions(
|
||||
helper: HelperVars,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
): Promise<AutocompleteCodeSnippet[]> {
|
||||
if (helper.options.useImports === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const importSnippets = [];
|
||||
const importSnippets: AutocompleteCodeSnippet[] = [];
|
||||
const fileInfo = this.importDefinitionsService.get(helper.filepath);
|
||||
if (fileInfo) {
|
||||
const { imports } = fileInfo;
|
||||
|
|
@ -104,21 +42,32 @@ export class ContextRetrievalService {
|
|||
for (const symbol of symbols) {
|
||||
const rifs = imports[symbol];
|
||||
if (Array.isArray(rifs)) {
|
||||
importSnippets.push(...rifs);
|
||||
const snippets: AutocompleteCodeSnippet[] = rifs.map((rif) => {
|
||||
return {
|
||||
filepath: rif.filepath,
|
||||
content: rif.contents,
|
||||
type: AutocompleteSnippetType.Code,
|
||||
};
|
||||
});
|
||||
|
||||
importSnippets.push(...snippets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return importSnippets;
|
||||
}
|
||||
|
||||
findMatchingRange(
|
||||
recentlyEditedRanges: RecentlyEditedRange[],
|
||||
linePrefix: string,
|
||||
): RecentlyEditedRange | undefined {
|
||||
return recentlyEditedRanges.find((recentlyEditedRange) => {
|
||||
return recentlyEditedRange.lines.some((line) =>
|
||||
line.startsWith(linePrefix),
|
||||
);
|
||||
});
|
||||
public async getRootPathSnippets(
|
||||
helper: HelperVars,
|
||||
): Promise<AutocompleteCodeSnippet[]> {
|
||||
if (!helper.treePath) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return this.rootPathContextService.getContextForPath(
|
||||
helper.filepath,
|
||||
helper.treePath,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
import { Range, RangeInFileWithContents } from "../../../";
|
||||
import { RangeInFileWithContents } from "../../../";
|
||||
import { countTokens } from "../../../llm/countTokens";
|
||||
import { AutocompleteSnippetDeprecated } from "../../types";
|
||||
import { HelperVars } from "../../util/HelperVars";
|
||||
|
||||
export type AutocompleteSnippet = RangeInFileWithContents & {
|
||||
score?: number;
|
||||
};
|
||||
|
||||
const rx = /[\s.,\/#!$%\^&\*;:{}=\-_`~()\[\]]/g;
|
||||
export function getSymbolsForSnippet(snippet: string): Set<string> {
|
||||
const symbols = snippet
|
||||
|
|
@ -18,7 +15,7 @@ export function getSymbolsForSnippet(snippet: string): Set<string> {
|
|||
/**
|
||||
* Calculate similarity as number of shared symbols divided by total number of unique symbols between both.
|
||||
*/
|
||||
export function jaccardSimilarity(a: string, b: string): number {
|
||||
function jaccardSimilarity(a: string, b: string): number {
|
||||
const aSet = getSymbolsForSnippet(a);
|
||||
const bSet = getSymbolsForSnippet(b);
|
||||
const union = new Set([...aSet, ...bSet]).size;
|
||||
|
|
@ -42,9 +39,9 @@ export function jaccardSimilarity(a: string, b: string): number {
|
|||
* Rank code snippets to be used in tab-autocomplete prompt. Returns a sorted version of the snippet array.
|
||||
*/
|
||||
export function rankAndOrderSnippets(
|
||||
ranges: AutocompleteSnippet[],
|
||||
ranges: AutocompleteSnippetDeprecated[],
|
||||
helper: HelperVars,
|
||||
): Required<AutocompleteSnippet>[] {
|
||||
): Required<AutocompleteSnippetDeprecated>[] {
|
||||
const windowAroundCursor =
|
||||
helper.fullPrefix.slice(
|
||||
-helper.options.slidingWindowSize *
|
||||
|
|
@ -55,11 +52,14 @@ export function rankAndOrderSnippets(
|
|||
(1 - helper.options.slidingWindowPrefixPercentage),
|
||||
);
|
||||
|
||||
const snippets: Required<AutocompleteSnippet>[] = ranges.map((snippet) => ({
|
||||
score:
|
||||
snippet.score ?? jaccardSimilarity(snippet.contents, windowAroundCursor),
|
||||
...snippet,
|
||||
}));
|
||||
const snippets: Required<AutocompleteSnippetDeprecated>[] = ranges.map(
|
||||
(snippet) => ({
|
||||
score:
|
||||
snippet.score ??
|
||||
jaccardSimilarity(snippet.contents, windowAroundCursor),
|
||||
...snippet,
|
||||
}),
|
||||
);
|
||||
const uniqueSnippets = deduplicateSnippets(snippets);
|
||||
return uniqueSnippets.sort((a, b) => a.score - b.score);
|
||||
}
|
||||
|
|
@ -67,11 +67,13 @@ export function rankAndOrderSnippets(
|
|||
/**
|
||||
* Deduplicate code snippets by merging overlapping ranges into a single range.
|
||||
*/
|
||||
export function deduplicateSnippets(
|
||||
snippets: Required<AutocompleteSnippet>[],
|
||||
): Required<AutocompleteSnippet>[] {
|
||||
function deduplicateSnippets(
|
||||
snippets: Required<AutocompleteSnippetDeprecated>[],
|
||||
): Required<AutocompleteSnippetDeprecated>[] {
|
||||
// Group by file
|
||||
const fileGroups: { [key: string]: Required<AutocompleteSnippet>[] } = {};
|
||||
const fileGroups: {
|
||||
[key: string]: Required<AutocompleteSnippetDeprecated>[];
|
||||
} = {};
|
||||
for (const snippet of snippets) {
|
||||
if (!fileGroups[snippet.filepath]) {
|
||||
fileGroups[snippet.filepath] = [];
|
||||
|
|
@ -88,8 +90,8 @@ export function deduplicateSnippets(
|
|||
}
|
||||
|
||||
function mergeSnippetsByRange(
|
||||
snippets: Required<AutocompleteSnippet>[],
|
||||
): Required<AutocompleteSnippet>[] {
|
||||
snippets: Required<AutocompleteSnippetDeprecated>[],
|
||||
): Required<AutocompleteSnippetDeprecated>[] {
|
||||
if (snippets.length <= 1) {
|
||||
return snippets;
|
||||
}
|
||||
|
|
@ -97,7 +99,7 @@ function mergeSnippetsByRange(
|
|||
const sorted = snippets.sort(
|
||||
(a, b) => a.range.start.line - b.range.start.line,
|
||||
);
|
||||
const merged: Required<AutocompleteSnippet>[] = [];
|
||||
const merged: Required<AutocompleteSnippetDeprecated>[] = [];
|
||||
|
||||
while (sorted.length > 0) {
|
||||
const next = sorted.shift()!;
|
||||
|
|
@ -133,12 +135,12 @@ function mergeOverlappingRangeContents(
|
|||
* It is assumed that the snippets are sorted by score.
|
||||
*/
|
||||
export function fillPromptWithSnippets(
|
||||
snippets: Required<AutocompleteSnippet>[],
|
||||
snippets: Required<AutocompleteSnippetDeprecated>[],
|
||||
maxSnippetTokens: number,
|
||||
modelName: string,
|
||||
): Required<AutocompleteSnippet>[] {
|
||||
): Required<AutocompleteSnippetDeprecated>[] {
|
||||
let tokensRemaining = maxSnippetTokens;
|
||||
const keptSnippets: Required<AutocompleteSnippet>[] = [];
|
||||
const keptSnippets: Required<AutocompleteSnippetDeprecated>[] = [];
|
||||
for (let i = 0; i < snippets.length; i++) {
|
||||
const snippet = snippets[i];
|
||||
const tokenCount = countTokens(snippet.contents, modelName);
|
||||
|
|
@ -151,58 +153,3 @@ export function fillPromptWithSnippets(
|
|||
|
||||
return keptSnippets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove one range from another range, which may lead to returning two disjoint ranges
|
||||
*/
|
||||
function rangeDifferenceByLines(orig: Range, remove: Range): Range[] {
|
||||
if (
|
||||
orig.start.line >= remove.start.line &&
|
||||
orig.end.line <= remove.end.line
|
||||
) {
|
||||
// / | | /
|
||||
return [];
|
||||
}
|
||||
if (
|
||||
orig.start.line <= remove.start.line &&
|
||||
orig.end.line >= remove.end.line
|
||||
) {
|
||||
// | / / |
|
||||
// Splits the range
|
||||
return [
|
||||
{
|
||||
start: orig.start,
|
||||
end: remove.start,
|
||||
},
|
||||
{
|
||||
start: remove.end,
|
||||
end: orig.end,
|
||||
},
|
||||
];
|
||||
}
|
||||
if (
|
||||
orig.start.line >= remove.start.line &&
|
||||
orig.end.line >= remove.end.line
|
||||
) {
|
||||
// \ | / |
|
||||
return [
|
||||
{
|
||||
start: remove.end,
|
||||
end: orig.end,
|
||||
},
|
||||
];
|
||||
}
|
||||
if (
|
||||
orig.start.line <= remove.start.line &&
|
||||
orig.end.line <= remove.end.line
|
||||
) {
|
||||
// | / | /
|
||||
return [
|
||||
{
|
||||
start: orig.start,
|
||||
end: remove.start,
|
||||
},
|
||||
];
|
||||
}
|
||||
return [orig];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
import { RangeInFileWithContents } from "../../../";
|
||||
|
||||
import { AutocompleteSnippet, jaccardSimilarity } from "./";
|
||||
|
||||
function* slidingWindow(
|
||||
content: string,
|
||||
windowSize: number,
|
||||
): Generator<string> {
|
||||
const lines = content.split("\n");
|
||||
|
||||
let charCount = 0;
|
||||
let currWindowLines: string[] = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (charCount + lines[i].length >= windowSize) {
|
||||
yield currWindowLines.join("\n");
|
||||
currWindowLines = [lines[i]];
|
||||
charCount = 0;
|
||||
} else {
|
||||
currWindowLines.push(lines[i]);
|
||||
}
|
||||
charCount += lines[i].length;
|
||||
}
|
||||
|
||||
if (currWindowLines.length > 0) {
|
||||
yield currWindowLines.join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Match by similarity over sliding windows of recent documents.
|
||||
* @param recentFiles
|
||||
* @param prefix
|
||||
* @param suffix
|
||||
*/
|
||||
export async function slidingWindowMatcher(
|
||||
recentFiles: RangeInFileWithContents[],
|
||||
windowAroundCursor: string,
|
||||
topN: number,
|
||||
windowSize: number,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
// Sorted lowest similarity to highest
|
||||
const topMatches: Required<AutocompleteSnippet>[] = [];
|
||||
|
||||
for (const { filepath, contents, range } of recentFiles) {
|
||||
for (const window of slidingWindow(contents, windowSize)) {
|
||||
const score = jaccardSimilarity(window, windowAroundCursor);
|
||||
|
||||
// Insertion sort
|
||||
let i = -1;
|
||||
while (++i < topMatches.length && score > topMatches[i].score) {}
|
||||
topMatches.splice(i + 1, 0, { filepath, contents, score, range });
|
||||
if (topMatches.length > topN) {
|
||||
topMatches.shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: convert the arbitrary window frame to some whole AST node?
|
||||
return topMatches;
|
||||
}
|
||||
|
|
@ -12,7 +12,11 @@ import {
|
|||
} from "../../../util/treeSitter";
|
||||
import { AstPath } from "../../util/ast";
|
||||
import { ImportDefinitionsService } from "../ImportDefinitionsService";
|
||||
import { AutocompleteSnippet } from "../ranking";
|
||||
import { AutocompleteSnippetDeprecated } from "../../types";
|
||||
import {
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "../../snippets/types";
|
||||
|
||||
function getSyntaxTreeString(
|
||||
node: Parser.SyntaxNode,
|
||||
|
|
@ -30,7 +34,7 @@ function getSyntaxTreeString(
|
|||
}
|
||||
|
||||
export class RootPathContextService {
|
||||
private cache = new LRUCache<string, AutocompleteSnippet[]>({
|
||||
private cache = new LRUCache<string, AutocompleteSnippetDeprecated[]>({
|
||||
max: 100,
|
||||
});
|
||||
|
||||
|
|
@ -72,8 +76,8 @@ export class RootPathContextService {
|
|||
private async getSnippetsForNode(
|
||||
filepath: string,
|
||||
node: Parser.SyntaxNode,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
const snippets: AutocompleteSnippet[] = [];
|
||||
): Promise<AutocompleteSnippetDeprecated[]> {
|
||||
const snippets: AutocompleteSnippetDeprecated[] = [];
|
||||
const language = getFullLanguageName(filepath);
|
||||
|
||||
let query: Parser.Query | undefined;
|
||||
|
|
@ -123,7 +127,7 @@ export class RootPathContextService {
|
|||
filepath: string,
|
||||
endPosition: Parser.Point,
|
||||
language: LanguageName,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
): Promise<AutocompleteSnippetDeprecated[]> {
|
||||
const definitions = await this.ide.gotoDefinition({
|
||||
filepath,
|
||||
position: {
|
||||
|
|
@ -153,8 +157,8 @@ export class RootPathContextService {
|
|||
filepath: string,
|
||||
astPath: AstPath,
|
||||
// cursorIndex: number,
|
||||
): Promise<AutocompleteSnippet[]> {
|
||||
const snippets: AutocompleteSnippet[] = [];
|
||||
): Promise<AutocompleteCodeSnippet[]> {
|
||||
const snippets: AutocompleteCodeSnippet[] = [];
|
||||
|
||||
let parentKey = filepath;
|
||||
for (const astNode of astPath.filter((node) =>
|
||||
|
|
@ -167,7 +171,16 @@ export class RootPathContextService {
|
|||
const foundInCache = this.cache.get(key);
|
||||
const newSnippets =
|
||||
foundInCache ?? (await this.getSnippetsForNode(filepath, astNode));
|
||||
snippets.push(...newSnippets);
|
||||
|
||||
const formattedSnippets: AutocompleteCodeSnippet[] = newSnippets.map(
|
||||
(item) => ({
|
||||
filepath: item.filepath,
|
||||
content: item.contents,
|
||||
type: AutocompleteSnippetType.Code,
|
||||
}),
|
||||
);
|
||||
|
||||
snippets.push(...formattedSnippets);
|
||||
|
||||
if (!foundInCache) {
|
||||
this.cache.set(key, newSnippets);
|
||||
|
|
|
|||
|
|
@ -313,6 +313,26 @@ export const Timer = () => {
|
|||
expectedCompletion: undefined,
|
||||
filename: "Timer.tsx",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete simple return statement in TypeScript",
|
||||
filename: "file.ts",
|
||||
input: `
|
||||
multiply(number) {
|
||||
this.result *= number;
|
||||
return <|fim|>
|
||||
}
|
||||
|
||||
divide(number) {
|
||||
if (number === 0) {
|
||||
throw new Error("Cannot divide by zero");
|
||||
}
|
||||
this.result /= number;
|
||||
return this;
|
||||
}
|
||||
`,
|
||||
llmOutput: ` this;`,
|
||||
expectedCompletion: `this;`,
|
||||
},
|
||||
];
|
||||
|
||||
export const TEST_CASES_WITHOUT_DIFF: AutocompleteFileringTestInput[] = [
|
||||
|
|
@ -1616,7 +1636,19 @@ interface User {
|
|||
age: number;
|
||||
}`,
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete TypeScript interface declarations",
|
||||
filename: "autocomplete.ts",
|
||||
input: `interface AutocompleteDiffSnippet extends BaseAutocompleteSnippet {}
|
||||
|
||||
interface AutocompleteCodeSnippet`,
|
||||
llmOutput: ` extends BaseAutocompleteSnippet {
|
||||
filepath: string;
|
||||
}`,
|
||||
expectedCompletion: ` extends BaseAutocompleteSnippet {
|
||||
filepath: string;
|
||||
}`,
|
||||
},
|
||||
{
|
||||
description:
|
||||
"Should autocomplete a TypeScript arrow function inside a variable assignment",
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ export async function testAutocompleteFiltering(
|
|||
const line = prefix.split("\n").length - 1;
|
||||
const character = prefix.split("\n")[line].length;
|
||||
const autocompleteInput: AutocompleteInput = {
|
||||
clipboardText: "",
|
||||
completionId: "test-completion-id",
|
||||
filepath,
|
||||
pos: {
|
||||
|
|
|
|||
|
|
@ -120,10 +120,5 @@ export function postprocessCompletion({
|
|||
completion = completion.slice(1);
|
||||
}
|
||||
|
||||
// Qwen often adds an extra space to the start
|
||||
if (llm.model.toLowerCase().includes("qwen") && completion.startsWith(" ")) {
|
||||
completion = completion.slice(1);
|
||||
}
|
||||
|
||||
return completion;
|
||||
}
|
||||
|
|
|
|||
136
core/autocomplete/snippets/getAllSnippets.ts
Normal file
136
core/autocomplete/snippets/getAllSnippets.ts
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
import { IDE } from "../../index";
|
||||
import { ContextRetrievalService } from "../context/ContextRetrievalService";
|
||||
import { GetLspDefinitionsFunction } from "../types";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
import {
|
||||
AutocompleteClipboardSnippet,
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteDiffSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "./types";
|
||||
|
||||
export interface SnippetPayload {
|
||||
rootPathSnippets: AutocompleteCodeSnippet[];
|
||||
importDefinitionSnippets: AutocompleteCodeSnippet[];
|
||||
ideSnippets: AutocompleteCodeSnippet[];
|
||||
recentlyEditedRangeSnippets: AutocompleteCodeSnippet[];
|
||||
diffSnippets: AutocompleteDiffSnippet[];
|
||||
clipboardSnippets: AutocompleteClipboardSnippet[];
|
||||
}
|
||||
|
||||
function racePromise<T>(promise: Promise<T[]>): Promise<T[]> {
|
||||
const timeoutPromise = new Promise<T[]>((resolve) => {
|
||||
setTimeout(() => resolve([]), 100);
|
||||
});
|
||||
|
||||
return Promise.race([promise, timeoutPromise]);
|
||||
}
|
||||
|
||||
// Some IDEs might have special ways of finding snippets (e.g. JetBrains and VS Code have different "LSP-equivalent" systems,
|
||||
// or they might separately track recently edited ranges)
|
||||
async function getIdeSnippets(
|
||||
helper: HelperVars,
|
||||
ide: IDE,
|
||||
getDefinitionsFromLsp: GetLspDefinitionsFunction,
|
||||
): Promise<AutocompleteCodeSnippet[]> {
|
||||
const ideSnippets = await getDefinitionsFromLsp(
|
||||
helper.input.filepath,
|
||||
helper.fullPrefix + helper.fullSuffix,
|
||||
helper.fullPrefix.length,
|
||||
ide,
|
||||
helper.lang,
|
||||
);
|
||||
|
||||
if (helper.options.onlyMyCode) {
|
||||
const workspaceDirs = await ide.getWorkspaceDirs();
|
||||
|
||||
return ideSnippets.filter((snippet) =>
|
||||
workspaceDirs.some((dir) => snippet.filepath.startsWith(dir)),
|
||||
);
|
||||
}
|
||||
|
||||
return ideSnippets;
|
||||
}
|
||||
|
||||
function getSnippetsFromRecentlyEditedRanges(
|
||||
helper: HelperVars,
|
||||
): AutocompleteCodeSnippet[] {
|
||||
if (helper.options.useRecentlyEdited === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return helper.input.recentlyEditedRanges.map((range) => {
|
||||
return {
|
||||
filepath: range.filepath,
|
||||
content: range.lines.join("\n"),
|
||||
type: AutocompleteSnippetType.Code,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const getClipboardSnippets = async (
|
||||
ide: IDE,
|
||||
): Promise<AutocompleteClipboardSnippet[]> => {
|
||||
const content = await ide.getClipboardContent();
|
||||
|
||||
return [content].map((item) => {
|
||||
return {
|
||||
content: item.text,
|
||||
copiedAt: item.copiedAt,
|
||||
type: AutocompleteSnippetType.Clipboard,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const getDiffSnippets = async (
|
||||
ide: IDE,
|
||||
): Promise<AutocompleteDiffSnippet[]> => {
|
||||
const diff = await ide.getDiff(true);
|
||||
|
||||
return diff.map((item) => {
|
||||
return {
|
||||
content: item,
|
||||
type: AutocompleteSnippetType.Diff,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
export const getAllSnippets = async ({
|
||||
helper,
|
||||
ide,
|
||||
getDefinitionsFromLsp,
|
||||
contextRetrievalService,
|
||||
}: {
|
||||
helper: HelperVars;
|
||||
ide: IDE;
|
||||
getDefinitionsFromLsp: GetLspDefinitionsFunction;
|
||||
contextRetrievalService: ContextRetrievalService;
|
||||
}): Promise<SnippetPayload> => {
|
||||
const recentlyEditedRangeSnippets =
|
||||
getSnippetsFromRecentlyEditedRanges(helper);
|
||||
|
||||
const [
|
||||
rootPathSnippets,
|
||||
importDefinitionSnippets,
|
||||
ideSnippets,
|
||||
diffSnippets,
|
||||
clipboardSnippets,
|
||||
] = await Promise.all([
|
||||
racePromise(contextRetrievalService.getRootPathSnippets(helper)),
|
||||
racePromise(
|
||||
contextRetrievalService.getSnippetsFromImportDefinitions(helper),
|
||||
),
|
||||
racePromise(getIdeSnippets(helper, ide, getDefinitionsFromLsp)),
|
||||
racePromise(getDiffSnippets(ide)),
|
||||
racePromise(getClipboardSnippets(ide)),
|
||||
]);
|
||||
|
||||
return {
|
||||
rootPathSnippets,
|
||||
importDefinitionSnippets,
|
||||
ideSnippets,
|
||||
recentlyEditedRangeSnippets,
|
||||
diffSnippets,
|
||||
clipboardSnippets,
|
||||
};
|
||||
};
|
||||
1
core/autocomplete/snippets/index.ts
Normal file
1
core/autocomplete/snippets/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./getAllSnippets";
|
||||
29
core/autocomplete/snippets/types.ts
Normal file
29
core/autocomplete/snippets/types.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
export enum AutocompleteSnippetType {
|
||||
Code = "code",
|
||||
Diff = "diff",
|
||||
Clipboard = "clipboard",
|
||||
}
|
||||
|
||||
interface BaseAutocompleteSnippet {
|
||||
content: string;
|
||||
type: AutocompleteSnippetType;
|
||||
}
|
||||
|
||||
export interface AutocompleteCodeSnippet extends BaseAutocompleteSnippet {
|
||||
filepath: string;
|
||||
type: AutocompleteSnippetType.Code;
|
||||
}
|
||||
|
||||
export interface AutocompleteDiffSnippet extends BaseAutocompleteSnippet {
|
||||
type: AutocompleteSnippetType.Diff;
|
||||
}
|
||||
|
||||
export interface AutocompleteClipboardSnippet extends BaseAutocompleteSnippet {
|
||||
type: AutocompleteSnippetType.Clipboard;
|
||||
copiedAt: string;
|
||||
}
|
||||
|
||||
export type AutocompleteSnippet =
|
||||
| AutocompleteCodeSnippet
|
||||
| AutocompleteDiffSnippet
|
||||
| AutocompleteClipboardSnippet;
|
||||
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
import { CompletionOptions } from "../../index.js";
|
||||
import { getLastNPathParts, shortestRelativePaths } from "../../util/index.js";
|
||||
import { AutocompleteSnippet } from "../context/ranking/index.js";
|
||||
import {
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "../snippets/types.js";
|
||||
|
||||
export interface AutocompleteTemplate {
|
||||
compilePrefixSuffix?: (
|
||||
|
|
@ -81,13 +85,24 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = {
|
|||
}
|
||||
return [prefix, suffix];
|
||||
}
|
||||
|
||||
const relativePaths = shortestRelativePaths([
|
||||
...snippets.map((snippet) => snippet.filepath),
|
||||
...snippets.map((snippet) =>
|
||||
"filepath" in snippet ? snippet.filepath : "Untitled.txt",
|
||||
),
|
||||
filepath,
|
||||
]);
|
||||
|
||||
const otherFiles = snippets
|
||||
.map((snippet, i) => `+++++ ${relativePaths[i]}\n${snippet.contents}`)
|
||||
.map((snippet, i) => {
|
||||
if (snippet.type === AutocompleteSnippetType.Diff) {
|
||||
return snippet.content;
|
||||
}
|
||||
|
||||
return `+++++ ${relativePaths[i]}\n${snippet.content}`;
|
||||
})
|
||||
.join("\n\n");
|
||||
|
||||
return [
|
||||
`${otherFiles}\n\n+++++ ${
|
||||
relativePaths[relativePaths.length - 1]
|
||||
|
|
@ -95,14 +110,7 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = {
|
|||
suffix,
|
||||
];
|
||||
},
|
||||
template: (
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
filepath: string,
|
||||
reponame: string,
|
||||
language: string,
|
||||
snippets: AutocompleteSnippet[],
|
||||
): string => {
|
||||
template: (prefix: string, suffix: string): string => {
|
||||
return `[SUFFIX]${suffix}[PREFIX]${prefix}`;
|
||||
},
|
||||
completionOptions: {
|
||||
|
|
@ -140,8 +148,7 @@ const starcoder2FimTemplate: AutocompleteTemplate = {
|
|||
? ""
|
||||
: `<file_sep>${snippets
|
||||
.map((snippet) => {
|
||||
return snippet.contents;
|
||||
// return `${getBasename(snippet.filepath)}\n${snippet.contents}`;
|
||||
return snippet.content;
|
||||
})
|
||||
.join("<file_sep>")}<file_sep>`;
|
||||
|
||||
|
|
@ -187,8 +194,12 @@ const codegeexFimTemplate: AutocompleteTemplate = {
|
|||
filepath: string,
|
||||
reponame: string,
|
||||
language: string,
|
||||
snippets: AutocompleteSnippet[],
|
||||
allSnippets: AutocompleteSnippet[],
|
||||
): string => {
|
||||
const snippets = allSnippets.filter(
|
||||
(snippet) => snippet.type === AutocompleteSnippetType.Code,
|
||||
) as AutocompleteCodeSnippet[];
|
||||
|
||||
const relativePaths = shortestRelativePaths([
|
||||
...snippets.map((snippet) => snippet.filepath),
|
||||
filepath,
|
||||
|
|
@ -200,7 +211,7 @@ const codegeexFimTemplate: AutocompleteTemplate = {
|
|||
return `<|user|>\n${baseTemplate}<|assistant|>\n`;
|
||||
}
|
||||
const references = `###REFERENCE:\n${snippets
|
||||
.map((snippet, i) => `###PATH:${relativePaths[i]}\n${snippet.contents}\n`)
|
||||
.map((snippet, i) => `###PATH:${relativePaths[i]}\n${snippet.content}\n`)
|
||||
.join("###REFERENCE:\n")}`;
|
||||
const prompt = `<|user|>\n${references}\n${baseTemplate}<|assistant|>\n`;
|
||||
return prompt;
|
||||
|
|
@ -227,14 +238,7 @@ Fill in the blank to complete the code block. Your response should include only
|
|||
};
|
||||
|
||||
const holeFillerTemplate: AutocompleteTemplate = {
|
||||
template: (
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
filename: string,
|
||||
reponame: string,
|
||||
language: string,
|
||||
snippets: AutocompleteSnippet[],
|
||||
) => {
|
||||
template: (prefix: string, suffix: string) => {
|
||||
// From https://github.com/VictorTaelin/AI-scripts
|
||||
const SYSTEM_MSG = `You are a HOLE FILLER. You are provided with a file containing holes, formatted as '{{HOLE_NAME}}'. Your TASK is to complete with a string to replace this hole with, inside a <COMPLETION/> XML tag, including context-aware indentation, if needed. All completions MUST be truthful, accurate, well-written and correct.
|
||||
|
||||
|
|
|
|||
75
core/autocomplete/templating/filtering.ts
Normal file
75
core/autocomplete/templating/filtering.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import { countTokens } from "../../llm/countTokens";
|
||||
import { SnippetPayload } from "../snippets";
|
||||
import {
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteSnippet,
|
||||
} from "../snippets/types";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
import { isValidSnippet } from "./validation";
|
||||
|
||||
const getRemainingTokenCount = (helper: HelperVars): number => {
|
||||
const tokenCount = countTokens(helper.prunedCaretWindow, helper.modelName);
|
||||
|
||||
return helper.options.maxPromptTokens - tokenCount;
|
||||
};
|
||||
|
||||
const TOKEN_BUFFER = 10; // We may need extra tokens for snippet description etc.
|
||||
|
||||
/**
|
||||
* Shuffles an array in place using the Fisher-Yates algorithm.
|
||||
* @param array The array to shuffle.
|
||||
* @returns The shuffled array.
|
||||
*/
|
||||
const shuffleArray = <T>(array: T[]): T[] => {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
return array;
|
||||
};
|
||||
|
||||
function filterSnippetsAlreadyInCaretWindow(
|
||||
snippets: AutocompleteCodeSnippet[],
|
||||
caretWindow: string,
|
||||
): AutocompleteCodeSnippet[] {
|
||||
return snippets.filter(
|
||||
(s) => s.content.trim() !== "" && !caretWindow.includes(s.content.trim()),
|
||||
);
|
||||
}
|
||||
|
||||
export const getSnippets = (
|
||||
helper: HelperVars,
|
||||
payload: SnippetPayload,
|
||||
): AutocompleteSnippet[] => {
|
||||
const snippets = [
|
||||
...payload.diffSnippets,
|
||||
...payload.clipboardSnippets,
|
||||
...shuffleArray(
|
||||
filterSnippetsAlreadyInCaretWindow(
|
||||
[...payload.rootPathSnippets],
|
||||
helper.prunedCaretWindow,
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
const finalSnippets = [];
|
||||
|
||||
let remainingTokenCount = getRemainingTokenCount(helper);
|
||||
|
||||
while (remainingTokenCount > 0 && snippets.length > 0) {
|
||||
const snippet = snippets.shift();
|
||||
if (!snippet || !isValidSnippet(snippet)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const snippetSize =
|
||||
countTokens(snippet.content, helper.modelName) + TOKEN_BUFFER;
|
||||
|
||||
if (remainingTokenCount >= snippetSize) {
|
||||
finalSnippets.push(snippet);
|
||||
remainingTokenCount -= snippetSize;
|
||||
}
|
||||
}
|
||||
|
||||
return finalSnippets;
|
||||
};
|
||||
107
core/autocomplete/templating/formatting.ts
Normal file
107
core/autocomplete/templating/formatting.ts
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
import { getLastNPathParts } from "../../util";
|
||||
import {
|
||||
AutocompleteClipboardSnippet,
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteDiffSnippet,
|
||||
AutocompleteSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "../snippets/types";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
|
||||
const getCommentMark = (helper: HelperVars) => {
|
||||
return helper.lang.singleLineComment;
|
||||
};
|
||||
|
||||
const addCommentMarks = (text: string, helper: HelperVars) => {
|
||||
const lines = [
|
||||
...text
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map((line) => `${getCommentMark(helper)} ${line}`),
|
||||
];
|
||||
return lines.join("\n");
|
||||
};
|
||||
|
||||
const formatClipboardSnippet = (
|
||||
snippet: AutocompleteClipboardSnippet,
|
||||
): AutocompleteCodeSnippet => {
|
||||
return formatCodeSnippet({
|
||||
filepath: "Untitled.txt",
|
||||
content: snippet.content,
|
||||
type: AutocompleteSnippetType.Code,
|
||||
});
|
||||
};
|
||||
|
||||
const formatCodeSnippet = (
|
||||
snippet: AutocompleteCodeSnippet,
|
||||
): AutocompleteCodeSnippet => {
|
||||
return {
|
||||
...snippet,
|
||||
content: `Path: ${getLastNPathParts(snippet.filepath, 2)}\n${snippet.content}`,
|
||||
};
|
||||
};
|
||||
|
||||
const formatDiffSnippet = (
|
||||
snippet: AutocompleteDiffSnippet,
|
||||
): AutocompleteDiffSnippet => {
|
||||
return snippet;
|
||||
};
|
||||
|
||||
const getCurrentFilepath = (helper: HelperVars) => {
|
||||
return getLastNPathParts(helper.filepath, 2);
|
||||
};
|
||||
|
||||
const commentifySnippet = (
|
||||
helper: HelperVars,
|
||||
snippet: AutocompleteSnippet,
|
||||
): AutocompleteSnippet => {
|
||||
return {
|
||||
...snippet,
|
||||
content: addCommentMarks(snippet.content, helper),
|
||||
};
|
||||
};
|
||||
|
||||
const SNIPPET_TYPES_TO_COMMENT = [
|
||||
AutocompleteSnippetType.Code,
|
||||
AutocompleteSnippetType.Clipboard,
|
||||
];
|
||||
|
||||
export const formatSnippets = (
|
||||
helper: HelperVars,
|
||||
snippets: AutocompleteSnippet[],
|
||||
): string => {
|
||||
const currentFilepathComment = addCommentMarks(
|
||||
getCurrentFilepath(helper),
|
||||
helper,
|
||||
);
|
||||
|
||||
return (
|
||||
snippets
|
||||
.map((snippet) => {
|
||||
switch (snippet.type) {
|
||||
case AutocompleteSnippetType.Code:
|
||||
return formatCodeSnippet(snippet);
|
||||
case AutocompleteSnippetType.Diff:
|
||||
return formatDiffSnippet(snippet);
|
||||
case AutocompleteSnippetType.Clipboard:
|
||||
return formatClipboardSnippet(snippet);
|
||||
}
|
||||
})
|
||||
.map((item) => {
|
||||
if (SNIPPET_TYPES_TO_COMMENT.includes(item.type)) {
|
||||
return commentifySnippet(helper, item);
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
.map((item) => {
|
||||
if (SNIPPET_TYPES_TO_COMMENT.includes(item.type)) {
|
||||
const commentMark = getCommentMark(helper);
|
||||
return item.content + `\n${commentMark}\n${commentMark}`;
|
||||
}
|
||||
|
||||
return item.content;
|
||||
})
|
||||
.join("\n") + `\n${currentFilepathComment}`
|
||||
);
|
||||
};
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
import Handlebars from "handlebars";
|
||||
|
||||
import { CompletionOptions } from "../..";
|
||||
import { getBasename, getLastNPathParts } from "../../util";
|
||||
import { getBasename } from "../../util";
|
||||
import { AutocompleteLanguageInfo } from "../constants/AutocompleteLanguageInfo";
|
||||
import { AutocompleteSnippet } from "../context/ranking";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
|
||||
import {
|
||||
|
|
@ -11,51 +10,10 @@ import {
|
|||
getTemplateForModel,
|
||||
} from "./AutocompleteTemplate";
|
||||
import { getStopTokens } from "./getStopTokens";
|
||||
import { countTokens } from "../../llm/countTokens";
|
||||
|
||||
const addCommentMarks = (text: string, language: AutocompleteLanguageInfo) => {
|
||||
const comment = language.singleLineComment;
|
||||
const lines = [
|
||||
...text
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map((line) => `${comment} ${line}`),
|
||||
];
|
||||
return lines.join("\n");
|
||||
};
|
||||
|
||||
export function formatExternalSnippet(
|
||||
filepath: string,
|
||||
snippet: string,
|
||||
language: AutocompleteLanguageInfo,
|
||||
) {
|
||||
const filePathString = `Path: ${getBasename(filepath)}\n`;
|
||||
return addCommentMarks(`${filePathString}${snippet}`, language);
|
||||
}
|
||||
|
||||
function getContextComments(
|
||||
snippets: AutocompleteSnippet[],
|
||||
lang: AutocompleteLanguageInfo,
|
||||
filepath: string,
|
||||
) {
|
||||
if (snippets.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const headerSnipper = `\n\n${lang.singleLineComment} Related code:\n`;
|
||||
const fileNameSnippet = `\n\n${lang.singleLineComment} ${getLastNPathParts(filepath, 2)}\n\n`;
|
||||
|
||||
const formattedSnippets =
|
||||
headerSnipper +
|
||||
snippets
|
||||
.map((snippet) =>
|
||||
formatExternalSnippet(snippet.filepath, snippet.contents, lang),
|
||||
)
|
||||
.join("\n") +
|
||||
fileNameSnippet;
|
||||
|
||||
return formattedSnippets;
|
||||
}
|
||||
import { AutocompleteCodeSnippet } from "../snippets/types";
|
||||
import { SnippetPayload } from "../snippets";
|
||||
import { formatSnippets } from "./formatting";
|
||||
import { getSnippets } from "./filtering";
|
||||
|
||||
function getTemplate(helper: HelperVars): AutocompleteTemplate {
|
||||
if (helper.options.template) {
|
||||
|
|
@ -88,63 +46,14 @@ function renderStringTemplate(
|
|||
});
|
||||
}
|
||||
|
||||
const formatDiff = (helper: HelperVars, diff?: string) => {
|
||||
if (!diff) return "";
|
||||
|
||||
const tokenCount = countTokens(diff, helper.modelName);
|
||||
|
||||
if (tokenCount > helper.maxDiffTokens) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `${diff}\n\n`;
|
||||
};
|
||||
|
||||
const MAX_CLIPBOARD_AGE = 5 * 60 * 1000;
|
||||
|
||||
const formatClipboardContent = (
|
||||
helper: HelperVars,
|
||||
{ text, copiedAt }: { text: string; copiedAt: string },
|
||||
) => {
|
||||
const currDate = new Date();
|
||||
|
||||
const isTooOld =
|
||||
currDate.getTime() - new Date(copiedAt).getTime() > MAX_CLIPBOARD_AGE;
|
||||
|
||||
if (isTooOld) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const tokenCount = countTokens(text, helper.modelName);
|
||||
const isTooLong = tokenCount > helper.maxClipboardTokens;
|
||||
|
||||
if (isTooLong) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return (
|
||||
addCommentMarks(
|
||||
`Recently copied by user:${text.includes("\n") ? "\n" : ""} ${text}`,
|
||||
helper.lang,
|
||||
) + "\n"
|
||||
);
|
||||
};
|
||||
|
||||
export function renderPrompt({
|
||||
snippets,
|
||||
snippetPayload,
|
||||
workspaceDirs,
|
||||
helper,
|
||||
diff,
|
||||
clipboardContent,
|
||||
}: {
|
||||
snippets: AutocompleteSnippet[];
|
||||
snippetPayload: SnippetPayload;
|
||||
workspaceDirs: string[];
|
||||
helper: HelperVars;
|
||||
diff?: string;
|
||||
clipboardContent: {
|
||||
text: string;
|
||||
copiedAt: string;
|
||||
};
|
||||
}): {
|
||||
prompt: string;
|
||||
prefix: string;
|
||||
|
|
@ -160,6 +69,8 @@ export function renderPrompt({
|
|||
const { template, compilePrefixSuffix, completionOptions } =
|
||||
getTemplate(helper);
|
||||
|
||||
const snippets = getSnippets(helper, snippetPayload);
|
||||
|
||||
// Some models have prompts that need two passes. This lets us pass the compiled prefix/suffix
|
||||
// into either the 2nd template to generate a raw string, or to pass prefix, suffix to a FIM endpoint
|
||||
if (compilePrefixSuffix) {
|
||||
|
|
@ -171,17 +82,8 @@ export function renderPrompt({
|
|||
snippets,
|
||||
);
|
||||
} else {
|
||||
const contextComments = getContextComments(
|
||||
snippets,
|
||||
helper.lang,
|
||||
helper.filepath,
|
||||
);
|
||||
const formattedDiff = formatDiff(helper, diff);
|
||||
const formattedClipboard = formatClipboardContent(helper, clipboardContent);
|
||||
|
||||
prefix = [formattedClipboard, formattedDiff, contextComments, prefix].join(
|
||||
"",
|
||||
);
|
||||
const formattedSnippets = formatSnippets(helper, snippets);
|
||||
prefix = [formattedSnippets, prefix].join("\n");
|
||||
}
|
||||
|
||||
const prompt =
|
||||
|
|
|
|||
29
core/autocomplete/templating/validation.ts
Normal file
29
core/autocomplete/templating/validation.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import {
|
||||
AutocompleteClipboardSnippet,
|
||||
AutocompleteSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "../snippets/types";
|
||||
|
||||
const MAX_CLIPBOARD_AGE = 5 * 60 * 1000;
|
||||
|
||||
const isValidClipboardSnippet = (
|
||||
snippet: AutocompleteClipboardSnippet,
|
||||
): boolean => {
|
||||
const currDate = new Date();
|
||||
|
||||
const isTooOld =
|
||||
currDate.getTime() - new Date(snippet.copiedAt).getTime() >
|
||||
MAX_CLIPBOARD_AGE;
|
||||
|
||||
return !isTooOld;
|
||||
};
|
||||
|
||||
export const isValidSnippet = (snippet: AutocompleteSnippet): boolean => {
|
||||
if (snippet.content.trim() === "") return false;
|
||||
|
||||
if (snippet.type === AutocompleteSnippetType.Clipboard) {
|
||||
return isValidClipboardSnippet(snippet);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
20
core/autocomplete/types.ts
Normal file
20
core/autocomplete/types.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { IDE, RangeInFileWithContents } from "../index";
|
||||
import { AutocompleteLanguageInfo } from "./constants/AutocompleteLanguageInfo";
|
||||
import { AutocompleteCodeSnippet } from "./snippets/types";
|
||||
|
||||
/**
|
||||
* @deprecated This type should be removed in the future or renamed.
|
||||
* We have a new interface called AutocompleteSnippet which is more
|
||||
* general.
|
||||
*/
|
||||
export type AutocompleteSnippetDeprecated = RangeInFileWithContents & {
|
||||
score?: number;
|
||||
};
|
||||
|
||||
export type GetLspDefinitionsFunction = (
|
||||
filepath: string,
|
||||
contents: string,
|
||||
cursorIndex: number,
|
||||
ide: IDE,
|
||||
lang: AutocompleteLanguageInfo,
|
||||
) => Promise<AutocompleteCodeSnippet[]>;
|
||||
|
|
@ -112,7 +112,6 @@ export class AutocompleteLoggingService {
|
|||
multilineCompletions: restOfOutcome.multilineCompletions,
|
||||
time: restOfOutcome.time,
|
||||
useRecentlyEdited: restOfOutcome.useRecentlyEdited,
|
||||
useRootPathContext: restOfOutcome.useRootPathContext,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -114,17 +114,6 @@ export class HelperVars {
|
|||
get pos() {
|
||||
return this.input.pos;
|
||||
}
|
||||
get maxSnippetTokens() {
|
||||
return this.options.maxPromptTokens * this.options.maxSnippetPercentage;
|
||||
}
|
||||
|
||||
get maxDiffTokens() {
|
||||
return this.options.maxPromptTokens * this.options.maxDiffPercentage;
|
||||
}
|
||||
|
||||
get maxClipboardTokens() {
|
||||
return this.options.maxPromptTokens * this.options.maxClipboardPercentage;
|
||||
}
|
||||
|
||||
get prunedCaretWindow() {
|
||||
return this.prunedPrefix + this.prunedSuffix;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ export interface AutocompleteInput {
|
|||
pos: Position;
|
||||
recentlyEditedFiles: RangeInFileWithContents[];
|
||||
recentlyEditedRanges: RecentlyEditedRange[];
|
||||
clipboardText: string;
|
||||
// Used for notebook files
|
||||
manuallyPassFileContents?: string;
|
||||
// Used for VS Code git commit input box
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@ const CommitMessageCommand: SlashCommand = {
|
|||
const includeUnstaged = params?.includeUnstaged ?? false;
|
||||
const diff = await ide.getDiff(includeUnstaged);
|
||||
|
||||
if (!diff || diff.trim() === "") {
|
||||
if (diff.length === 0) {
|
||||
yield "No changes detected. Make sure you are in a git repository with current changes.";
|
||||
return;
|
||||
}
|
||||
|
||||
const prompt = `${diff}\n\nGenerate a commit message for the above set of changes. First, give a single sentence, no more than 80 characters. Then, after 2 line breaks, give a list of no more than 5 short bullet points, each no more than 40 characters. Output nothing except for the commit message, and don't surround it in quotes.`;
|
||||
for await (const chunk of llm.streamChat([
|
||||
{ role: "user", content: prompt },
|
||||
], new AbortController().signal)) {
|
||||
const prompt = `${diff.join("\n")}\n\nGenerate a commit message for the above set of changes. First, give a single sentence, no more than 80 characters. Then, after 2 line breaks, give a list of no more than 5 short bullet points, each no more than 40 characters. Output nothing except for the commit message, and don't surround it in quotes.`;
|
||||
for await (const chunk of llm.streamChat(
|
||||
[{ role: "user", content: prompt }],
|
||||
new AbortController().signal,
|
||||
)) {
|
||||
yield stripImages(chunk.content);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { config } from "dotenv";
|
||||
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
ContinueConfig,
|
||||
|
|
|
|||
|
|
@ -527,6 +527,7 @@ function finalToBrowserConfig(
|
|||
embeddingsProvider: final.embeddingsProvider?.id,
|
||||
ui: final.ui,
|
||||
experimental: final.experimental,
|
||||
docs: final.docs,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,10 @@ export function slashCommandFromPromptFile(
|
|||
systemMessage,
|
||||
);
|
||||
|
||||
for await (const chunk of context.llm.streamChat(messages, new AbortController().signal)) {
|
||||
for await (const chunk of context.llm.streamChat(
|
||||
messages,
|
||||
new AbortController().signal,
|
||||
)) {
|
||||
yield stripImages(chunk.content);
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +176,7 @@ async function renderPrompt(
|
|||
const diff = await context.ide.getDiff(false);
|
||||
const currentFile = await context.ide.getCurrentFile();
|
||||
const inputData: Record<string, string> = {
|
||||
diff,
|
||||
diff: diff.join("\n"),
|
||||
input: userInput,
|
||||
};
|
||||
if (currentFile) {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ declare global {
|
|||
loadSubmenuItems(args: LoadSubmenuItemsArgs): Promise<ContextSubmenuItem[]>;
|
||||
}
|
||||
|
||||
export interface PersistedSessionInfo {
|
||||
export interface Session {
|
||||
history: ChatHistory;
|
||||
title: string;
|
||||
workspaceDirectory: string;
|
||||
|
|
@ -825,7 +825,6 @@ declare global {
|
|||
|
||||
export interface TabAutocompleteOptions {
|
||||
disable: boolean;
|
||||
useCopyBuffer: boolean;
|
||||
useFileSuffix: boolean;
|
||||
maxPromptTokens: number;
|
||||
debounceDelay: number;
|
||||
|
|
@ -835,14 +834,9 @@ declare global {
|
|||
multilineCompletions: "always" | "never" | "auto";
|
||||
slidingWindowPrefixPercentage: number;
|
||||
slidingWindowSize: number;
|
||||
maxSnippetPercentage: number;
|
||||
maxDiffPercentage: number;
|
||||
maxClipboardPercentage: number;
|
||||
useCache: boolean;
|
||||
onlyMyCode: boolean;
|
||||
useOtherFiles: boolean;
|
||||
useRecentlyEdited: boolean;
|
||||
recentLinePrefixMatchMinLength: number;
|
||||
disableInFiles?: string[];
|
||||
useImports?: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class DiffContextProvider extends BaseContextProvider {
|
|||
{
|
||||
description: "The current git diff",
|
||||
content:
|
||||
diff.trim() === ""
|
||||
diff.length === 0
|
||||
? "Git shows no current changes."
|
||||
: `\`\`\`git diff\n${diff}\n\`\`\``,
|
||||
: `\`\`\`git diff\n${diff.join("\n")}\n\`\`\``,
|
||||
name: "Git Diff",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
31
core/core.ts
31
core/core.ts
|
|
@ -19,6 +19,7 @@ import { ControlPlaneClient } from "./control-plane/client";
|
|||
import { streamDiffLines } from "./edit/streamDiffLines";
|
||||
import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer";
|
||||
import DocsService from "./indexing/docs/DocsService";
|
||||
import { getAllSuggestedDocs } from "./indexing/docs/suggestions";
|
||||
import { defaultIgnoreFile } from "./indexing/ignore.js";
|
||||
import Ollama from "./llm/llms/Ollama";
|
||||
import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile";
|
||||
|
|
@ -28,11 +29,7 @@ import { DevDataSqliteDb } from "./util/devdataSqlite";
|
|||
import { fetchwithRequestOptions } from "./util/fetchWithOptions";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import historyManager from "./util/history";
|
||||
import {
|
||||
editConfigJson,
|
||||
getConfigJsonPath,
|
||||
setupInitialDotContinueDirectory,
|
||||
} from "./util/paths";
|
||||
import { editConfigJson, setupInitialDotContinueDirectory } from "./util/paths";
|
||||
import { Telemetry } from "./util/posthog";
|
||||
import { getSymbolsForManyFiles } from "./util/treeSitter";
|
||||
import { TTS } from "./util/tts";
|
||||
|
|
@ -413,6 +410,16 @@ export class Core {
|
|||
if (config.experimental?.readResponseTTS && "completion" in next.value) {
|
||||
void TTS.read(next.value?.completion);
|
||||
}
|
||||
|
||||
void Telemetry.capture(
|
||||
"chat",
|
||||
{
|
||||
model: model.model,
|
||||
provider: model.providerName,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
return { done: true, content: next.value };
|
||||
}
|
||||
|
||||
|
|
@ -734,8 +741,16 @@ export class Core {
|
|||
this.docsService.setPaused(msg.data.id, msg.data.paused);
|
||||
}
|
||||
});
|
||||
on("indexing/initStatuses", async (msg) => {
|
||||
return this.docsService.initStatuses();
|
||||
on("docs/getSuggestedDocs", async (msg) => {
|
||||
if (hasRequestedDocs) {
|
||||
return;
|
||||
} // TODO, remove, hack because of rerendering
|
||||
hasRequestedDocs = true;
|
||||
const suggestedDocs = await getAllSuggestedDocs(this.ide);
|
||||
this.messenger.send("docs/suggestions", suggestedDocs);
|
||||
});
|
||||
on("docs/initStatuses", async (msg) => {
|
||||
void this.docsService.initStatuses();
|
||||
});
|
||||
//
|
||||
|
||||
|
|
@ -841,3 +856,5 @@ export class Core {
|
|||
|
||||
// private
|
||||
}
|
||||
|
||||
let hasRequestedDocs = false;
|
||||
|
|
|
|||
59
core/index.d.ts
vendored
59
core/index.d.ts
vendored
|
|
@ -68,8 +68,6 @@ export interface IndexingStatus {
|
|||
url?: string;
|
||||
}
|
||||
|
||||
export type IndexingStatusMap = Map<string, IndexingStatus>;
|
||||
|
||||
export type PromptTemplateFunction = (
|
||||
history: ChatMessage[],
|
||||
otherData: Record<string, string>,
|
||||
|
|
@ -237,15 +235,15 @@ export interface Checkpoint {
|
|||
[filepath: string]: string;
|
||||
}
|
||||
|
||||
export interface PersistedSessionInfo {
|
||||
history: ChatHistory;
|
||||
export interface Session {
|
||||
sessionId: string;
|
||||
title: string;
|
||||
workspaceDirectory: string;
|
||||
sessionId: string;
|
||||
history: ChatHistoryItem[];
|
||||
checkpoints?: Checkpoint[];
|
||||
}
|
||||
|
||||
export interface SessionInfo {
|
||||
export interface SessionMetadata {
|
||||
sessionId: string;
|
||||
title: string;
|
||||
dateCreated: string;
|
||||
|
|
@ -357,8 +355,6 @@ export interface ChatHistoryItem {
|
|||
promptLogs?: PromptLog[];
|
||||
}
|
||||
|
||||
export type ChatHistory = ChatHistoryItem[];
|
||||
|
||||
// LLM
|
||||
|
||||
export interface LLMFullCompletionOptions extends BaseCompletionOptions {
|
||||
|
|
@ -507,7 +503,7 @@ export interface IdeSettings {
|
|||
export interface IDE {
|
||||
getIdeInfo(): Promise<IdeInfo>;
|
||||
getIdeSettings(): Promise<IdeSettings>;
|
||||
getDiff(includeUnstaged: boolean): Promise<string>;
|
||||
getDiff(includeUnstaged: boolean): Promise<string[]>;
|
||||
getClipboardContent(): Promise<{ text: string; copiedAt: string }>;
|
||||
isTelemetryEnabled(): Promise<boolean>;
|
||||
getUniqueId(): Promise<string>;
|
||||
|
|
@ -968,7 +964,6 @@ export interface Reranker {
|
|||
|
||||
export interface TabAutocompleteOptions {
|
||||
disable: boolean;
|
||||
useCopyBuffer: boolean;
|
||||
useFileSuffix: boolean;
|
||||
maxPromptTokens: number;
|
||||
debounceDelay: number;
|
||||
|
|
@ -979,17 +974,11 @@ export interface TabAutocompleteOptions {
|
|||
multilineCompletions: "always" | "never" | "auto";
|
||||
slidingWindowPrefixPercentage: number;
|
||||
slidingWindowSize: number;
|
||||
maxSnippetPercentage: number;
|
||||
maxDiffPercentage: number;
|
||||
maxClipboardPercentage: number;
|
||||
useCache: boolean;
|
||||
onlyMyCode: boolean;
|
||||
useOtherFiles: boolean;
|
||||
useRecentlyEdited: boolean;
|
||||
recentLinePrefixMatchMinLength: number;
|
||||
disableInFiles?: string[];
|
||||
useImports?: boolean;
|
||||
useRootPathContext?: boolean;
|
||||
showWhateverWeHaveAtXMs?: number;
|
||||
}
|
||||
|
||||
|
|
@ -1220,4 +1209,42 @@ export interface BrowserSerializedContinueConfig {
|
|||
reranker?: RerankerDescription;
|
||||
experimental?: ExperimentalConfig;
|
||||
analytics?: AnalyticsConfig;
|
||||
docs?: SiteIndexingConfig[];
|
||||
}
|
||||
|
||||
// DOCS SUGGESTIONS AND PACKAGE INFO
|
||||
export interface FilePathAndName {
|
||||
path: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PackageFilePathAndName extends FilePathAndName {
|
||||
packageRegistry: string; // e.g. npm, pypi
|
||||
}
|
||||
|
||||
export type ParsedPackageInfo = {
|
||||
name: string;
|
||||
packageFile: PackageFilePathAndName;
|
||||
language: string;
|
||||
version: string;
|
||||
};
|
||||
|
||||
export type PackageDetails = {
|
||||
docsLink?: string;
|
||||
docsLinkWarning?: string;
|
||||
title?: string;
|
||||
description?: string;
|
||||
repo?: string;
|
||||
license?: string;
|
||||
};
|
||||
|
||||
export type PackageDetailsSuccess = PackageDetails & {
|
||||
docsLink: string;
|
||||
};
|
||||
|
||||
export type PackageDocsResult = {
|
||||
packageInfo: ParsedPackageInfo;
|
||||
} & (
|
||||
| { error: string; details?: never }
|
||||
| { details: PackageDetailsSuccess; error?: never }
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {
|
|||
ContinueConfig,
|
||||
EmbeddingsProvider,
|
||||
IDE,
|
||||
IndexingStatusMap,
|
||||
IndexingStatus,
|
||||
SiteIndexingConfig,
|
||||
IdeInfo,
|
||||
|
|
@ -87,7 +86,6 @@ export type AddParams = {
|
|||
export default class DocsService {
|
||||
static lanceTableName = "docs";
|
||||
static sqlitebTableName = "docs";
|
||||
static indexingType = "docs";
|
||||
|
||||
static preIndexedDocsEmbeddingsProvider =
|
||||
new TransformersJsEmbeddingsProvider();
|
||||
|
|
@ -137,38 +135,60 @@ export default class DocsService {
|
|||
configHandler.onConfigUpdate(this.handleConfigUpdate.bind(this));
|
||||
}
|
||||
|
||||
readonly statuses: IndexingStatusMap = new Map();
|
||||
|
||||
// Function for GUI to retrieve initial pending statuses
|
||||
// And kickoff indexing where needed
|
||||
async initStatuses() {
|
||||
this.config?.docs?.forEach(async (doc) => {
|
||||
const currentStatus = this.statuses.get(doc.startUrl);
|
||||
if (currentStatus) {
|
||||
this.handleStatusUpdate(currentStatus);
|
||||
} else {
|
||||
this.handleStatusUpdate({
|
||||
type: "docs",
|
||||
id: doc.startUrl,
|
||||
embeddingsProviderId: this.config.embeddingsProvider.id,
|
||||
isReindexing: false,
|
||||
progress: 0,
|
||||
description: "Pending",
|
||||
status: "pending",
|
||||
title: doc.title,
|
||||
debugInfo: `max depth: ${doc.maxDepth}`,
|
||||
icon: doc.faviconUrl,
|
||||
url: doc.startUrl,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
readonly statuses: Map<string, IndexingStatus> = new Map();
|
||||
|
||||
handleStatusUpdate(update: IndexingStatus) {
|
||||
this.statuses.set(update.id, update);
|
||||
this.messenger?.send("indexing/statusUpdate", update);
|
||||
}
|
||||
|
||||
// A way for gui to retrieve initial statuses
|
||||
async initStatuses(): Promise<void> {
|
||||
if (!this.config?.docs) {
|
||||
return;
|
||||
}
|
||||
const metadata = await this.listMetadata();
|
||||
|
||||
this.config.docs?.forEach((doc) => {
|
||||
if (!doc.startUrl) {
|
||||
console.error("Invalid config docs entry, no start");
|
||||
return;
|
||||
}
|
||||
|
||||
const currentStatus = this.statuses.get(doc.startUrl);
|
||||
if (currentStatus) {
|
||||
return currentStatus;
|
||||
}
|
||||
|
||||
const sharedStatus = {
|
||||
type: "docs" as IndexingStatus["type"],
|
||||
id: doc.startUrl,
|
||||
embeddingsProviderId: this.config.embeddingsProvider.id,
|
||||
isReindexing: false,
|
||||
title: doc.title,
|
||||
debugInfo: `max depth: ${doc.maxDepth}`,
|
||||
icon: doc.faviconUrl,
|
||||
url: doc.startUrl,
|
||||
};
|
||||
const indexedStatus: IndexingStatus = metadata.find(
|
||||
(meta) => meta.startUrl === doc.startUrl,
|
||||
)
|
||||
? {
|
||||
...sharedStatus,
|
||||
progress: 0,
|
||||
description: "Pending",
|
||||
status: "pending",
|
||||
}
|
||||
: {
|
||||
...sharedStatus,
|
||||
progress: 1,
|
||||
description: "Complete",
|
||||
status: "complete",
|
||||
};
|
||||
this.handleStatusUpdate(indexedStatus);
|
||||
});
|
||||
}
|
||||
|
||||
abort(startUrl: string) {
|
||||
const status = this.statuses.get(startUrl);
|
||||
if (status) {
|
||||
|
|
@ -363,6 +383,7 @@ export default class DocsService {
|
|||
|
||||
const indexExists = await this.hasMetadata(startUrl);
|
||||
|
||||
// Build status update - most of it is fixed values
|
||||
const fixedStatus: Pick<
|
||||
IndexingStatus,
|
||||
| "type"
|
||||
|
|
@ -384,6 +405,8 @@ export default class DocsService {
|
|||
url: siteIndexingConfig.startUrl,
|
||||
};
|
||||
|
||||
// Clear current indexes if reIndexing
|
||||
//
|
||||
if (indexExists) {
|
||||
if (reIndex) {
|
||||
await this.deleteIndexes(startUrl);
|
||||
|
|
@ -399,6 +422,12 @@ export default class DocsService {
|
|||
}
|
||||
}
|
||||
|
||||
// If not preindexed
|
||||
const isPreIndexedDoc = !!preIndexedDocs[siteIndexingConfig.startUrl];
|
||||
if (!isPreIndexedDoc) {
|
||||
this.addToConfig(siteIndexingConfig);
|
||||
}
|
||||
|
||||
try {
|
||||
this.handleStatusUpdate({
|
||||
...fixedStatus,
|
||||
|
|
@ -436,7 +465,7 @@ export default class DocsService {
|
|||
articles.push(article);
|
||||
|
||||
processedPages++;
|
||||
await new Promise((resolve) => setTimeout(resolve, 50)); // Locks down GUI if no sleeping
|
||||
await new Promise((resolve) => setTimeout(resolve, 100)); // Locks down GUI if no sleeping
|
||||
}
|
||||
|
||||
void Telemetry.capture("docs_pages_crawled", {
|
||||
|
|
@ -789,19 +818,13 @@ export default class DocsService {
|
|||
}
|
||||
}
|
||||
|
||||
// Sends "Pending" or current status for each
|
||||
await this.initStatuses();
|
||||
|
||||
for (const doc of changedDocs) {
|
||||
console.log(`Updating indexed doc: ${doc.startUrl}`);
|
||||
await this.indexAndAdd(doc, true);
|
||||
}
|
||||
await Promise.allSettled([
|
||||
...changedDocs.map((doc) => this.indexAndAdd(doc, true)),
|
||||
...newDocs.map((doc) => this.indexAndAdd(doc)),
|
||||
]);
|
||||
|
||||
for (const doc of newDocs) {
|
||||
console.log(`Indexing new doc: ${doc.startUrl}`);
|
||||
void Telemetry.capture("add_docs_config", { url: doc.startUrl });
|
||||
|
||||
await this.indexAndAdd(doc);
|
||||
}
|
||||
|
||||
for (const doc of deletedDocs) {
|
||||
|
|
@ -942,7 +965,7 @@ export default class DocsService {
|
|||
);
|
||||
}
|
||||
|
||||
private addToConfig({ siteIndexingConfig }: AddParams) {
|
||||
private addToConfig(siteIndexingConfig: SiteIndexingConfig) {
|
||||
// Handles the case where a user has manually added the doc to config.json
|
||||
// so it already exists in the file
|
||||
const doesDocExist = this.config.docs?.some(
|
||||
|
|
@ -960,13 +983,6 @@ export default class DocsService {
|
|||
private async add(params: AddParams) {
|
||||
await this.addToLance(params);
|
||||
await this.addMetadataToSqlite(params);
|
||||
|
||||
const isPreIndexedDoc =
|
||||
!!preIndexedDocs[params.siteIndexingConfig.startUrl];
|
||||
|
||||
if (!isPreIndexedDoc) {
|
||||
this.addToConfig(params);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete methods
|
||||
|
|
@ -1031,10 +1047,7 @@ export default class DocsService {
|
|||
console.log(
|
||||
`Reindexing non-preindexed docs with new embeddings provider: ${embeddingsProvider.id}`,
|
||||
);
|
||||
await this.initStatuses();
|
||||
for (const doc of docs) {
|
||||
await this.indexAndAdd(doc, true);
|
||||
}
|
||||
await Promise.allSettled(docs.map((doc) => this.indexAndAdd(doc)));
|
||||
|
||||
// Important that this only is invoked after we have successfully
|
||||
// cleared and reindex the docs so that the table cannot end up in an
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ export class ChromiumInstaller {
|
|||
|
||||
private async proposeInstall(site: string) {
|
||||
const msg =
|
||||
`Unable to crawl documentation site: ${site}\n` +
|
||||
`Unable to crawl documentation site: "${site}".` +
|
||||
"We recommend installing Chromium. " +
|
||||
"Download progress can be viewed in the developer console.";
|
||||
|
||||
|
|
|
|||
134
core/indexing/docs/suggestions/index.ts
Normal file
134
core/indexing/docs/suggestions/index.ts
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
import {
|
||||
PackageDocsResult,
|
||||
FilePathAndName,
|
||||
PackageFilePathAndName,
|
||||
IDE,
|
||||
PackageDetails,
|
||||
ParsedPackageInfo,
|
||||
} from "../../..";
|
||||
import { walkDir } from "../../walkDir";
|
||||
|
||||
import { PythonPackageCrawler } from "./packageCrawlers/Python";
|
||||
import { NodePackageCrawler } from "./packageCrawlers/TsJs";
|
||||
|
||||
const PACKAGE_CRAWLERS = [NodePackageCrawler, PythonPackageCrawler];
|
||||
|
||||
export interface PackageCrawler {
|
||||
packageRegistry: string;
|
||||
getPackageFiles(files: FilePathAndName[]): PackageFilePathAndName[];
|
||||
parsePackageFile(
|
||||
file: PackageFilePathAndName,
|
||||
contents: string,
|
||||
): ParsedPackageInfo[];
|
||||
getPackageDetails(packageInfo: ParsedPackageInfo): Promise<PackageDetails>;
|
||||
}
|
||||
|
||||
export async function getAllSuggestedDocs(ide: IDE) {
|
||||
const workspaceDirs = await ide.getWorkspaceDirs();
|
||||
const results = await Promise.all(
|
||||
workspaceDirs.map((dir) => {
|
||||
return walkDir(dir, ide);
|
||||
}),
|
||||
);
|
||||
const allPaths = results.flat(); // TODO only get files, not dirs. Not critical for now
|
||||
const allFiles = allPaths.map((path) => ({
|
||||
path,
|
||||
name: path.split(/[\\/]/).pop()!,
|
||||
}));
|
||||
|
||||
// Build map of language -> package files
|
||||
const packageFilesByRegistry: Record<string, PackageFilePathAndName[]> = {};
|
||||
for (const Crawler of PACKAGE_CRAWLERS) {
|
||||
const crawler = new Crawler();
|
||||
const packageFilePaths = crawler.getPackageFiles(allFiles);
|
||||
packageFilesByRegistry[crawler.packageRegistry] = packageFilePaths;
|
||||
}
|
||||
|
||||
// Get file contents for all unique package files
|
||||
const uniqueFilePaths = Array.from(
|
||||
new Set(
|
||||
Object.values(packageFilesByRegistry).flatMap((files) =>
|
||||
files.map((file) => file.path),
|
||||
),
|
||||
),
|
||||
);
|
||||
const fileContentsArray = await Promise.all(
|
||||
uniqueFilePaths.map(async (path) => {
|
||||
const contents = await ide.readFile(path);
|
||||
return { path, contents };
|
||||
}),
|
||||
);
|
||||
const fileContents = new Map(
|
||||
fileContentsArray.map(({ path, contents }) => [path, contents]),
|
||||
);
|
||||
|
||||
// Parse package files and build map of language -> packages
|
||||
const packagesByCrawler: Record<string, ParsedPackageInfo[]> = {};
|
||||
PACKAGE_CRAWLERS.forEach((Crawler) => {
|
||||
const crawler = new Crawler();
|
||||
packagesByCrawler[crawler.packageRegistry] = [];
|
||||
const packageFiles = packageFilesByRegistry[crawler.packageRegistry];
|
||||
packageFiles.forEach((file) => {
|
||||
const contents = fileContents.get(file.path);
|
||||
if (!contents) {
|
||||
return;
|
||||
}
|
||||
const packages = crawler.parsePackageFile(file, contents);
|
||||
packagesByCrawler[crawler.packageRegistry].push(...packages);
|
||||
});
|
||||
});
|
||||
|
||||
// Deduplicate packages per language
|
||||
// TODO - this is where you would allow docs for different versions
|
||||
// by e.g. using "name-version" as the map key instead of just name
|
||||
// For now have not allowed
|
||||
const registries = Object.keys(packagesByCrawler);
|
||||
registries.forEach((registry) => {
|
||||
const packages = packagesByCrawler[registry];
|
||||
const uniquePackages = Array.from(
|
||||
new Map(packages.map((pkg) => [pkg.name, pkg])).values(),
|
||||
);
|
||||
packagesByCrawler[registry] = uniquePackages;
|
||||
});
|
||||
|
||||
// Get documentation links for all packages
|
||||
const allDocsResults: PackageDocsResult[] = [];
|
||||
await Promise.all(
|
||||
PACKAGE_CRAWLERS.map(async (Crawler) => {
|
||||
const crawler = new Crawler();
|
||||
const packages = packagesByCrawler[crawler.packageRegistry];
|
||||
const docsByRegistry = await Promise.all(
|
||||
packages.map(async (packageInfo) => {
|
||||
try {
|
||||
const details = await crawler.getPackageDetails(packageInfo);
|
||||
if (!details.docsLink) {
|
||||
return {
|
||||
packageInfo,
|
||||
error: `No documentation link found for ${packageInfo.name}`,
|
||||
};
|
||||
}
|
||||
return {
|
||||
packageInfo,
|
||||
details: {
|
||||
...details,
|
||||
docsLink: details.docsLink,
|
||||
docsLinkWarning: details.docsLink.includes("github.com")
|
||||
? "Github docs not supported, find the docs site"
|
||||
: details.docsLink.includes("docs")
|
||||
? undefined
|
||||
: "May not be a docs site, check the URL",
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
packageInfo,
|
||||
error: `Error getting package details for ${packageInfo.name}`,
|
||||
};
|
||||
}
|
||||
}),
|
||||
);
|
||||
allDocsResults.push(...docsByRegistry);
|
||||
}),
|
||||
);
|
||||
return allDocsResults;
|
||||
}
|
||||
63
core/indexing/docs/suggestions/packageCrawlers/Python.ts
Normal file
63
core/indexing/docs/suggestions/packageCrawlers/Python.ts
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import { PackageCrawler } from "..";
|
||||
import {
|
||||
FilePathAndName,
|
||||
PackageDetails,
|
||||
PackageFilePathAndName,
|
||||
ParsedPackageInfo,
|
||||
} from "../../../..";
|
||||
|
||||
export class PythonPackageCrawler implements PackageCrawler {
|
||||
packageRegistry = "pypi";
|
||||
|
||||
getPackageFiles(files: FilePathAndName[]): PackageFilePathAndName[] {
|
||||
// For Python, we typically look for files like requirements.txt or Pipfile
|
||||
return files
|
||||
.filter(
|
||||
(file) => file.name === "requirements.txt" || file.name === "Pipfile",
|
||||
)
|
||||
.map((file) => ({
|
||||
...file,
|
||||
packageRegistry: "pypi",
|
||||
}));
|
||||
}
|
||||
|
||||
parsePackageFile(
|
||||
file: PackageFilePathAndName,
|
||||
contents: string,
|
||||
): ParsedPackageInfo[] {
|
||||
// Assume the fileContent is a string from a requirements.txt formatted file
|
||||
return contents
|
||||
.split("\n")
|
||||
.map((line) => {
|
||||
const [name, version] = line.split("==");
|
||||
return { name, version, packageFile: file, language: "py" };
|
||||
})
|
||||
.filter((pkg) => pkg.name && pkg.version);
|
||||
}
|
||||
|
||||
async getPackageDetails(
|
||||
packageInfo: ParsedPackageInfo,
|
||||
): Promise<PackageDetails> {
|
||||
// Fetch metadata from PyPI to find the documentation link
|
||||
const response = await fetch(
|
||||
`https://pypi.org/pypi/${packageInfo.name}/json`,
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Could not fetch data for package ${packageInfo.name}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
const homePage = data?.info?.home_page as string | undefined;
|
||||
|
||||
return {
|
||||
docsLink:
|
||||
(data?.info?.project_urls?.Documentation as string | undefined) ??
|
||||
homePage,
|
||||
title: data?.info?.name as string | undefined,
|
||||
description: data?.info?.summary as string | undefined,
|
||||
repo:
|
||||
(data?.info?.project_urls?.Repository as string | undefined) ??
|
||||
homePage,
|
||||
license: data?.info?.license as string | undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
77
core/indexing/docs/suggestions/packageCrawlers/TsJs.ts
Normal file
77
core/indexing/docs/suggestions/packageCrawlers/TsJs.ts
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import { PackageCrawler } from "..";
|
||||
import {
|
||||
FilePathAndName,
|
||||
PackageDetails,
|
||||
PackageFilePathAndName,
|
||||
ParsedPackageInfo,
|
||||
} from "../../../..";
|
||||
|
||||
export class NodePackageCrawler implements PackageCrawler {
|
||||
packageRegistry = "npm";
|
||||
|
||||
getPackageFiles(files: FilePathAndName[]): PackageFilePathAndName[] {
|
||||
// For Javascript/TypeScript, we look for package.json file
|
||||
return files
|
||||
.filter((file) => file.name === "package.json")
|
||||
.map((file) => ({
|
||||
...file,
|
||||
packageRegistry: this.packageRegistry,
|
||||
}));
|
||||
}
|
||||
|
||||
parsePackageFile(
|
||||
file: PackageFilePathAndName,
|
||||
contents: string,
|
||||
): ParsedPackageInfo[] {
|
||||
// Parse the package.json content
|
||||
const jsonData = JSON.parse(contents) as Record<string, Object>;
|
||||
const dependencies = Object.entries(jsonData.dependencies || {}).concat(
|
||||
Object.entries(jsonData.devDependencies || {}),
|
||||
);
|
||||
|
||||
// Filter out types packages and check if typescript is present
|
||||
let foundTypes = false;
|
||||
const filtered = dependencies.filter(([name, _]) => {
|
||||
if (name.startsWith("@types/")) {
|
||||
foundTypes = true;
|
||||
return false;
|
||||
}
|
||||
if (name.includes("typescript")) {
|
||||
foundTypes = true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return filtered.map(([name, version]) => ({
|
||||
name,
|
||||
version,
|
||||
packageFile: file,
|
||||
language: foundTypes ? "ts" : "js",
|
||||
}));
|
||||
}
|
||||
|
||||
async getPackageDetails(
|
||||
packageInfo: ParsedPackageInfo,
|
||||
): Promise<PackageDetails> {
|
||||
const { name } = packageInfo;
|
||||
// Fetch metadata from the NPM registry to find the documentation link
|
||||
const response = await fetch(`https://registry.npmjs.org/${name}`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Could not fetch data for package ${name}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
|
||||
// const dependencies = Object.keys(packageContentData.dependencies || {})
|
||||
// .concat(Object.keys(packageContentData.devDependencies || {}));
|
||||
// const usesTypescript = dependencies.includes("typescript");
|
||||
|
||||
return {
|
||||
docsLink: data.homepage as string | undefined,
|
||||
title: name, // package.json doesn't have specific title field
|
||||
description: data.description as string | undefined,
|
||||
repo: Array.isArray(data.repository)
|
||||
? (data.respository[0]?.url as string | undefined)
|
||||
: undefined,
|
||||
license: data.license as string | undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@ export default {
|
|||
moduleNameMapper: {
|
||||
"^(\\.{1,2}/.*)\\.js$": "$1",
|
||||
"^uuid$": "uuid", // https://stackoverflow.com/a/73626360
|
||||
'^@azure/(.*)$': '<rootDir>/node_modules/@azure/$1',
|
||||
'^mssql$': '<rootDir>/node_modules/mssql'
|
||||
},
|
||||
extensionsToTreatAsEsm: [".ts"],
|
||||
preset: "ts-jest/presets/default-esm",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ChatHistory, ChatMessage, MessagePart } from "../index.js";
|
||||
import { ChatHistoryItem, ChatMessage, MessagePart } from "../index.js";
|
||||
|
||||
const SYSTEM_MESSAGE = `When generating new code:
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ function hasCodeBlockWithFilename(content: ChatMessage["content"]): boolean {
|
|||
}
|
||||
|
||||
export function constructMessages(
|
||||
history: ChatHistory,
|
||||
history: ChatHistoryItem[],
|
||||
model: string,
|
||||
): ChatMessage[] {
|
||||
const msgs = [];
|
||||
|
|
|
|||
485
core/package-lock.json
generated
485
core/package-lock.json
generated
|
|
@ -24,7 +24,7 @@
|
|||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"comment-json": "^4.2.3",
|
||||
"dbinfoz": "^0.11.0",
|
||||
"dbinfoz": "^0.14.0",
|
||||
"diff": "^7.0.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
|
|
@ -1229,6 +1229,241 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/abort-controller": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
|
||||
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-auth": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz",
|
||||
"integrity": "sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-util": "^1.11.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-client": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.2.tgz",
|
||||
"integrity": "sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.4.0",
|
||||
"@azure/core-rest-pipeline": "^1.9.1",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.6.1",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-http-compat": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.1.2.tgz",
|
||||
"integrity": "sha512-5MnV1yqzZwgNLLjlizsU3QqOeQChkIXw781Fwh1xdAqJR5AA32IUaq6xv1BICJvfbHoa+JYcaij2HFkhLbNTJQ==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-client": "^1.3.0",
|
||||
"@azure/core-rest-pipeline": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-lro": {
|
||||
"version": "2.7.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.7.2.tgz",
|
||||
"integrity": "sha512-0YIpccoX8m/k00O7mDDMdJpbr6mf1yWo2dfmxt5A8XVZVVMz2SSKaEbMCeJRvgQ0IaSlqhjT47p4hVIRRy90xw==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-util": "^1.2.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-paging": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz",
|
||||
"integrity": "sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-rest-pipeline": {
|
||||
"version": "1.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.18.0.tgz",
|
||||
"integrity": "sha512-QSoGUp4Eq/gohEFNJaUOwTN7BCc2nHTjjbm75JT0aD7W65PWM1H/tItz0GsABn22uaKyGxiMhWQLt2r+FGU89Q==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.8.0",
|
||||
"@azure/core-tracing": "^1.0.1",
|
||||
"@azure/core-util": "^1.11.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
"https-proxy-agent": "^7.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-tracing": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz",
|
||||
"integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-util": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.11.0.tgz",
|
||||
"integrity": "sha512-DxOSLua+NdpWoSqULhjDyAZTXFdP/LKkqtYuxxz1SCN289zk3OG8UOpnCQAz/tygyACBtWp/BoO72ptK7msY8g==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/identity": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.5.0.tgz",
|
||||
"integrity": "sha512-EknvVmtBuSIic47xkOqyNabAme0RYTw52BTMz8eBgU1ysTyMrD1uOoM+JdS0J/4Yfp98IBT3osqq3BfwSaNaGQ==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.9.0",
|
||||
"@azure/core-client": "^1.9.2",
|
||||
"@azure/core-rest-pipeline": "^1.17.0",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.11.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"@azure/msal-browser": "^3.26.1",
|
||||
"@azure/msal-node": "^2.15.0",
|
||||
"events": "^3.0.0",
|
||||
"jws": "^4.0.0",
|
||||
"open": "^8.0.0",
|
||||
"stoppable": "^1.1.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/keyvault-common": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/keyvault-common/-/keyvault-common-2.0.0.tgz",
|
||||
"integrity": "sha512-wRLVaroQtOqfg60cxkzUkGKrKMsCP6uYXAOomOIysSMyt1/YM0eUn9LqieAWM8DLcU4+07Fio2YGpPeqUbpP9w==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-client": "^1.5.0",
|
||||
"@azure/core-rest-pipeline": "^1.8.0",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.10.0",
|
||||
"@azure/logger": "^1.1.4",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/keyvault-keys": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/keyvault-keys/-/keyvault-keys-4.9.0.tgz",
|
||||
"integrity": "sha512-ZBP07+K4Pj3kS4TF4XdkqFcspWwBHry3vJSOFM5k5ZABvf7JfiMonvaFk2nBF6xjlEbMpz5PE1g45iTMme0raQ==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-client": "^1.5.0",
|
||||
"@azure/core-http-compat": "^2.0.1",
|
||||
"@azure/core-lro": "^2.2.0",
|
||||
"@azure/core-paging": "^1.1.1",
|
||||
"@azure/core-rest-pipeline": "^1.8.1",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.0.0",
|
||||
"@azure/keyvault-common": "^2.0.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/logger": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.1.4.tgz",
|
||||
"integrity": "sha512-4IXXzcCdLdlXuCG+8UKEwLA1T1NHqUfanhXYHiQTn+6sfWCZXduqbtXDGceg3Ce5QxTGo7EqmbV6Bi+aqKuClQ==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-browser": {
|
||||
"version": "3.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-3.27.0.tgz",
|
||||
"integrity": "sha512-+b4ZKSD8+vslCtVRVetkegEhOFMLP3rxDWJY212ct+2r6jVg6OSQKc1Qz3kCoXo0FgwaXkb+76TMZfpHp8QtgA==",
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "14.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-common": {
|
||||
"version": "14.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.16.0.tgz",
|
||||
"integrity": "sha512-1KOZj9IpcDSwpNiQNjt0jDYZpQvNZay7QAEi/5DLubay40iGYtLzya/jbjRPLyOTZhEKyL1MzPuw2HqBCjceYA==",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node": {
|
||||
"version": "2.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.16.2.tgz",
|
||||
"integrity": "sha512-An7l1hEr0w1HMMh1LU+rtDtqL7/jw74ORlc9Wnh06v7TU/xpG39/Zdr1ZJu3QpjUfKJ+E0/OXMW8DRSWTlh7qQ==",
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "14.16.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"uuid": "^8.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.24.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz",
|
||||
|
|
@ -3855,6 +4090,11 @@
|
|||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@js-joda/core": {
|
||||
"version": "5.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@js-joda/core/-/core-5.6.3.tgz",
|
||||
"integrity": "sha512-T1rRxzdqkEXcou0ZprN1q9yDRlvzCPLqmlNt5IIsGBzoEVgLCCYrKEwc84+TvsXuAc95VAZwtWD2zVsKPY4bcA=="
|
||||
},
|
||||
"node_modules/@lancedb/vectordb-darwin-arm64": {
|
||||
"version": "0.4.20",
|
||||
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.20.tgz",
|
||||
|
|
@ -4814,6 +5054,11 @@
|
|||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
|
||||
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA=="
|
||||
},
|
||||
"node_modules/@tediousjs/connection-string": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@tediousjs/connection-string/-/connection-string-0.5.0.tgz",
|
||||
"integrity": "sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ=="
|
||||
},
|
||||
"node_modules/@tootallnate/once": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
|
||||
|
|
@ -5085,6 +5330,20 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/readable-stream": {
|
||||
"version": "4.0.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.18.tgz",
|
||||
"integrity": "sha512-21jK/1j+Wg+7jVw1xnSwy/2Q1VgVjWuFssbYGTREPUBeZ+rqVFl2udq0IkxzPC0ZhOzVceUbyIACFZKLqKEBlA==",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"safe-buffer": "~5.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/readable-stream/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"node_modules/@types/request": {
|
||||
"version": "2.48.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.12.tgz",
|
||||
|
|
@ -6273,7 +6532,6 @@
|
|||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.2.1"
|
||||
|
|
@ -6965,10 +7223,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/dbinfoz": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.11.0.tgz",
|
||||
"integrity": "sha512-l7REBd9pwTBI6PWSk/dx+zCpSE2tiJdSKfApeoOajnSgyMJgkwGfhpPO2mV76MLQeKPaSm0mMKxmoqd38SaHmw==",
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.14.0.tgz",
|
||||
"integrity": "sha512-8NLjmj3gEyxbMu1ZwPEby77QvoEkk5NrHKSwX4oSKeaREherwuSx1y08cXmxBEjrSmvByUX9axoKscuilSXfmg==",
|
||||
"dependencies": {
|
||||
"mssql": "^11.0.1",
|
||||
"mysql2": "^3.9.1",
|
||||
"pg": "^8.11.3",
|
||||
"sqlite3": "^5.1.7"
|
||||
|
|
@ -7061,6 +7320,14 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/define-lazy-prop": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
|
||||
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/define-properties": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
|
||||
|
|
@ -9373,6 +9640,20 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-docker": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-electron": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz",
|
||||
|
|
@ -9577,6 +9858,17 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-wsl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||
"dependencies": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/isarray": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||
|
|
@ -10559,6 +10851,11 @@
|
|||
"jinjajs": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/js-md4": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-md4/-/js-md4-0.3.2.tgz",
|
||||
"integrity": "sha512-/GDnfQYsltsjRswQhN9fhv3EMw2sCpUdrdxyWDOUK7eyD++r3gRhzgiQgc/x4MAv2i1iuQ4lxO5mvqM3vj4bwA=="
|
||||
},
|
||||
"node_modules/js-tiktoken": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.12.tgz",
|
||||
|
|
@ -10723,6 +11020,46 @@
|
|||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
|
||||
"integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
|
||||
"dependencies": {
|
||||
"jws": "^3.2.2",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken/node_modules/jwa": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
|
||||
"integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken/node_modules/jws": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
|
||||
"integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
|
||||
"dependencies": {
|
||||
"jwa": "^1.4.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jsprim": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
|
||||
|
|
@ -10888,6 +11225,36 @@
|
|||
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
|
||||
},
|
||||
"node_modules/lodash.isboolean": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
|
||||
},
|
||||
"node_modules/lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
|
||||
},
|
||||
"node_modules/lodash.isnumber": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
|
||||
},
|
||||
"node_modules/lodash.isstring": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
|
||||
},
|
||||
"node_modules/lodash.memoize": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||
|
|
@ -10899,6 +11266,11 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
|
||||
},
|
||||
"node_modules/lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
|
||||
},
|
||||
"node_modules/long": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
|
||||
|
|
@ -11288,6 +11660,33 @@
|
|||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/mssql": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mssql/-/mssql-11.0.1.tgz",
|
||||
"integrity": "sha512-KlGNsugoT90enKlR8/G36H0kTxPthDhmtNUCwEHvgRza5Cjpjoj+P2X6eMpFUDN7pFrJZsKadL4x990G8RBE1w==",
|
||||
"dependencies": {
|
||||
"@tediousjs/connection-string": "^0.5.0",
|
||||
"commander": "^11.0.0",
|
||||
"debug": "^4.3.3",
|
||||
"rfdc": "^1.3.0",
|
||||
"tarn": "^3.0.2",
|
||||
"tedious": "^18.2.1"
|
||||
},
|
||||
"bin": {
|
||||
"mssql": "bin/mssql"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/mssql/node_modules/commander": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/myers-diff": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/myers-diff/-/myers-diff-2.1.0.tgz",
|
||||
|
|
@ -11340,6 +11739,11 @@
|
|||
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
|
||||
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
||||
},
|
||||
"node_modules/native-duplexpair": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/native-duplexpair/-/native-duplexpair-1.0.0.tgz",
|
||||
"integrity": "sha512-E7QQoM+3jvNtlmyfqRZ0/U75VFgCls+fSkbml2MpgWkWyz3ox8Y58gNhfuziuQYGNNQAbFZJQck55LHCnCK6CA=="
|
||||
},
|
||||
"node_modules/natural-compare": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
|
|
@ -11798,6 +12202,22 @@
|
|||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
|
||||
},
|
||||
"node_modules/open": {
|
||||
"version": "8.4.2",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
|
||||
"integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
|
||||
"dependencies": {
|
||||
"define-lazy-prop": "^2.0.0",
|
||||
"is-docker": "^2.1.1",
|
||||
"is-wsl": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/openai": {
|
||||
"version": "4.47.1",
|
||||
"resolved": "https://registry.npmjs.org/openai/-/openai-4.47.1.tgz",
|
||||
|
|
@ -12513,7 +12933,6 @@
|
|||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
}
|
||||
|
|
@ -12875,7 +13294,6 @@
|
|||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
|
||||
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
|
|
@ -13148,6 +13566,11 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/rfdc": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
|
||||
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||
|
|
@ -13711,6 +14134,15 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/stoppable": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
|
||||
"integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==",
|
||||
"engines": {
|
||||
"node": ">=4",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/stream-read-all": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/stream-read-all/-/stream-read-all-3.0.1.tgz",
|
||||
|
|
@ -14083,6 +14515,45 @@
|
|||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tarn": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz",
|
||||
"integrity": "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious": {
|
||||
"version": "18.6.1",
|
||||
"resolved": "https://registry.npmjs.org/tedious/-/tedious-18.6.1.tgz",
|
||||
"integrity": "sha512-9AvErXXQTd6l7TDd5EmM+nxbOGyhnmdbp/8c3pw+tjaiSXW9usME90ET/CRG1LN1Y9tPMtz/p83z4Q97B4DDpw==",
|
||||
"dependencies": {
|
||||
"@azure/core-auth": "^1.7.2",
|
||||
"@azure/identity": "^4.2.1",
|
||||
"@azure/keyvault-keys": "^4.4.0",
|
||||
"@js-joda/core": "^5.6.1",
|
||||
"@types/node": ">=18",
|
||||
"bl": "^6.0.11",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"js-md4": "^0.3.2",
|
||||
"native-duplexpair": "^1.0.0",
|
||||
"sprintf-js": "^1.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious/node_modules/bl": {
|
||||
"version": "6.0.16",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-6.0.16.tgz",
|
||||
"integrity": "sha512-V/kz+z2Mx5/6qDfRCilmrukUXcXuCoXKg3/3hDvzKKoSUx8CJKudfIoT29XZc3UE9xBvxs5qictiHdprwtteEg==",
|
||||
"dependencies": {
|
||||
"@types/readable-stream": "^4.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/test-exclude": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"comment-json": "^4.2.3",
|
||||
"dbinfoz": "^0.11.0",
|
||||
"dbinfoz": "^0.14.0",
|
||||
"diff": "^7.0.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ import type {
|
|||
DiffLine,
|
||||
FileSymbolMap,
|
||||
IdeSettings,
|
||||
IndexingStatusMap,
|
||||
IndexingStatus,
|
||||
LLMFullCompletionOptions,
|
||||
MessageContent,
|
||||
ModelDescription,
|
||||
ModelRoles,
|
||||
PersistedSessionInfo,
|
||||
Session,
|
||||
RangeInFile,
|
||||
SerializedContinueConfig,
|
||||
SessionInfo,
|
||||
SessionMetadata,
|
||||
SiteIndexingConfig,
|
||||
} from "../";
|
||||
|
||||
|
|
@ -47,10 +47,10 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
abort: [undefined, void];
|
||||
|
||||
// History
|
||||
"history/list": [ListHistoryOptions, SessionInfo[]];
|
||||
"history/list": [ListHistoryOptions, SessionMetadata[]];
|
||||
"history/delete": [{ id: string }, void];
|
||||
"history/load": [{ id: string }, PersistedSessionInfo];
|
||||
"history/save": [PersistedSessionInfo, void];
|
||||
"history/load": [{ id: string }, Session];
|
||||
"history/save": [Session, void];
|
||||
"devdata/log": [{ tableName: string; data: any }, void];
|
||||
"config/addOpenAiKey": [string, void];
|
||||
"config/addModel": [
|
||||
|
|
@ -166,7 +166,8 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"indexing/reindex": [{ type: string; id: string }, void];
|
||||
"indexing/abort": [{ type: string; id: string }, void];
|
||||
"indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
|
||||
"indexing/initStatuses": [undefined, void];
|
||||
"docs/getSuggestedDocs": [undefined, void];
|
||||
"docs/initStatuses": [undefined, void];
|
||||
|
||||
addAutocompleteModel: [{ model: ModelDescription }, void];
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
getPinnedFiles: [undefined, string[]];
|
||||
showLines: [{ filepath: string; startLine: number; endLine: number }, void];
|
||||
readRangeInFile: [{ filepath: string; range: Range }, string];
|
||||
getDiff: [{ includeUnstaged: boolean }, string];
|
||||
getDiff: [{ includeUnstaged: boolean }, string[]];
|
||||
getWorkspaceConfigs: [undefined, ContinueRcJson[]];
|
||||
getTerminalContents: [undefined, string];
|
||||
getDebugLocals: [{ threadIndex: number }, string];
|
||||
|
|
|
|||
|
|
@ -48,10 +48,11 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
|
|||
"index/forceReIndexFiles",
|
||||
"index/indexingProgressBarInitialized",
|
||||
// Docs, etc.
|
||||
"indexing/initStatuses",
|
||||
"indexing/reindex",
|
||||
"indexing/abort",
|
||||
"indexing/setPaused",
|
||||
"docs/getSuggestedDocs",
|
||||
"docs/initStatuses",
|
||||
//
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel",
|
||||
|
|
@ -74,4 +75,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
|
|||
"getWebviewHistoryLength",
|
||||
"signInToControlPlane",
|
||||
"openDialogMessage",
|
||||
"docs/suggestions",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type {
|
|||
ContextItemWithId,
|
||||
IndexingProgressUpdate,
|
||||
IndexingStatus,
|
||||
PackageDocsResult,
|
||||
} from "../index.js";
|
||||
|
||||
export type ToWebviewFromIdeOrCoreProtocol = {
|
||||
|
|
@ -25,4 +26,5 @@ export type ToWebviewFromIdeOrCoreProtocol = {
|
|||
getWebviewHistoryLength: [undefined, number];
|
||||
signInToControlPlane: [undefined, void];
|
||||
openDialogMessage: ["account", void];
|
||||
"docs/suggestions": [PackageDocsResult[], void];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { PersistedSessionInfo } from "../..";
|
||||
import { Session } from "../..";
|
||||
import historyManager from "../../util/history";
|
||||
import { getSessionFilePath } from "../../util/paths";
|
||||
|
||||
const sessionId = uuidv4();
|
||||
const testSession: PersistedSessionInfo = {
|
||||
const testSession: Session = {
|
||||
history: [],
|
||||
title: `${sessionId} title`,
|
||||
workspaceDirectory: "workspaceDir",
|
||||
|
|
@ -43,7 +43,9 @@ describe("Full session lifecycle", () => {
|
|||
// save and list
|
||||
historyManager.save(testSession);
|
||||
const sessions = historyManager.list({});
|
||||
const sessionExists = sessions.some((session) => session?.sessionId === testSession.sessionId);
|
||||
const sessionExists = sessions.some(
|
||||
(session) => session?.sessionId === testSession.sessionId,
|
||||
);
|
||||
expect(sessionExists).toBe(true);
|
||||
});
|
||||
|
||||
|
|
@ -90,7 +92,9 @@ describe("Many sessions created", () => {
|
|||
const offset = 10;
|
||||
|
||||
const sessions = historyManager.list({ offset: offset, limit: limit });
|
||||
const sessionIds = Array.from({ length: limit }, (_, i) => (i + offset).toString());
|
||||
const sessionIds = Array.from({ length: limit }, (_, i) =>
|
||||
(i + offset).toString(),
|
||||
);
|
||||
const isSessionIdInList = (sessionId: string) =>
|
||||
sessions.some((session) => session.sessionId === sessionId);
|
||||
expect(sessionIds.every(isSessionIdInList)).toBe(true);
|
||||
|
|
@ -111,8 +115,9 @@ describe("Many sessions created", () => {
|
|||
const offset = 75;
|
||||
|
||||
const sessions = historyManager.list({ offset: offset });
|
||||
const sessionIds = Array.from({ length: sessions.length - offset }, (_, i) =>
|
||||
(i + offset).toString(),
|
||||
const sessionIds = Array.from(
|
||||
{ length: sessions.length - offset },
|
||||
(_, i) => (i + offset).toString(),
|
||||
);
|
||||
|
||||
const isSessionIdInList = (sessionId: string) =>
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ class FileSystemIde implements IDE {
|
|||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getDiff(includeUnstaged: boolean): Promise<string> {
|
||||
return Promise.resolve("");
|
||||
getDiff(includeUnstaged: boolean): Promise<string[]> {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getClipboardContent(): Promise<{ text: string; copiedAt: string }> {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as fs from "fs";
|
||||
|
||||
import { PersistedSessionInfo, SessionInfo } from "../index.js";
|
||||
import { Session, SessionMetadata } from "../index.js";
|
||||
import { ListHistoryOptions } from "../protocol/core.js";
|
||||
|
||||
import { getSessionFilePath, getSessionsListPath } from "./paths.js";
|
||||
|
|
@ -18,14 +18,14 @@ function safeParseArray<T>(
|
|||
}
|
||||
|
||||
class HistoryManager {
|
||||
list(options: ListHistoryOptions): SessionInfo[] {
|
||||
list(options: ListHistoryOptions): SessionMetadata[] {
|
||||
const filepath = getSessionsListPath();
|
||||
if (!fs.existsSync(filepath)) {
|
||||
return [];
|
||||
}
|
||||
const content = fs.readFileSync(filepath, "utf8");
|
||||
|
||||
let sessions = safeParseArray<SessionInfo>(content) ?? [];
|
||||
let sessions = safeParseArray<SessionMetadata>(content) ?? [];
|
||||
sessions = sessions.filter((session: any) => {
|
||||
// Filter out old format
|
||||
return typeof session.session_id !== "string";
|
||||
|
|
@ -52,7 +52,7 @@ class HistoryManager {
|
|||
const sessionsListFile = getSessionsListPath();
|
||||
const sessionsListRaw = fs.readFileSync(sessionsListFile, "utf-8");
|
||||
let sessionsList =
|
||||
safeParseArray<SessionInfo>(
|
||||
safeParseArray<SessionMetadata>(
|
||||
sessionsListRaw,
|
||||
"Error parsing sessions.json",
|
||||
) ?? [];
|
||||
|
|
@ -67,15 +67,13 @@ class HistoryManager {
|
|||
);
|
||||
}
|
||||
|
||||
load(sessionId: string): PersistedSessionInfo {
|
||||
load(sessionId: string): Session {
|
||||
try {
|
||||
const sessionFile = getSessionFilePath(sessionId);
|
||||
if (!fs.existsSync(sessionFile)) {
|
||||
throw new Error(`Session file ${sessionFile} does not exist`);
|
||||
}
|
||||
const session: PersistedSessionInfo = JSON.parse(
|
||||
fs.readFileSync(sessionFile, "utf8"),
|
||||
);
|
||||
const session: Session = JSON.parse(fs.readFileSync(sessionFile, "utf8"));
|
||||
session.sessionId = sessionId;
|
||||
return session;
|
||||
} catch (e) {
|
||||
|
|
@ -89,11 +87,20 @@ class HistoryManager {
|
|||
}
|
||||
}
|
||||
|
||||
save(session: PersistedSessionInfo) {
|
||||
save(session: Session) {
|
||||
// Save the main session json file
|
||||
// Explicitely rewriting here to influence the written key order in the file!
|
||||
// e.g. id at the top, history next, etc.
|
||||
const orderedSession: Session = {
|
||||
sessionId: session.sessionId,
|
||||
title: session.title,
|
||||
workspaceDirectory: session.workspaceDirectory,
|
||||
history: session.history,
|
||||
checkpoints: session.checkpoints,
|
||||
};
|
||||
fs.writeFileSync(
|
||||
getSessionFilePath(session.sessionId),
|
||||
JSON.stringify(session, undefined, 2),
|
||||
JSON.stringify(orderedSession, undefined, 2),
|
||||
);
|
||||
|
||||
// Read and update the sessions list
|
||||
|
|
@ -101,7 +108,7 @@ class HistoryManager {
|
|||
try {
|
||||
const rawSessionsList = fs.readFileSync(sessionsListFilePath, "utf-8");
|
||||
|
||||
let sessionsList: SessionInfo[];
|
||||
let sessionsList: SessionMetadata[];
|
||||
try {
|
||||
sessionsList = JSON.parse(rawSessionsList);
|
||||
} catch (e) {
|
||||
|
|
@ -114,23 +121,23 @@ class HistoryManager {
|
|||
}
|
||||
|
||||
let found = false;
|
||||
for (const sessionInfo of sessionsList) {
|
||||
if (sessionInfo.sessionId === session.sessionId) {
|
||||
sessionInfo.title = session.title;
|
||||
sessionInfo.workspaceDirectory = session.workspaceDirectory;
|
||||
for (const sessionMetadata of sessionsList) {
|
||||
if (sessionMetadata.sessionId === session.sessionId) {
|
||||
sessionMetadata.title = session.title;
|
||||
sessionMetadata.workspaceDirectory = session.workspaceDirectory;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
const sessionInfo: SessionInfo = {
|
||||
const sessionMetadata: SessionMetadata = {
|
||||
sessionId: session.sessionId,
|
||||
title: session.title,
|
||||
dateCreated: String(Date.now()),
|
||||
workspaceDirectory: session.workspaceDirectory,
|
||||
};
|
||||
sessionsList.push(sessionInfo);
|
||||
sessionsList.push(sessionMetadata);
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { TabAutocompleteOptions } from "../index.js";
|
|||
|
||||
export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
|
||||
disable: false,
|
||||
useCopyBuffer: false,
|
||||
useFileSuffix: true,
|
||||
maxPromptTokens: 1024,
|
||||
prefixPercentage: 0.85,
|
||||
|
|
@ -11,17 +10,11 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
|
|||
multilineCompletions: "auto",
|
||||
slidingWindowPrefixPercentage: 0.75,
|
||||
slidingWindowSize: 500,
|
||||
maxSnippetPercentage: 0.5,
|
||||
maxDiffPercentage: 0.5,
|
||||
maxClipboardPercentage: 0.5, // yes the percentages do not add up
|
||||
useCache: true,
|
||||
onlyMyCode: true,
|
||||
useOtherFiles: true,
|
||||
useRecentlyEdited: true,
|
||||
recentLinePrefixMatchMinLength: 7,
|
||||
disableInFiles: undefined,
|
||||
useImports: true,
|
||||
useRootPathContext: true,
|
||||
transform: true,
|
||||
showWhateverWeHaveAtXMs: 300,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,14 +9,12 @@ Continue offers a handful of parameters in [`config.json`](../reference.md) that
|
|||
|
||||
```json title="config.json"
|
||||
"tabAutocompleteOptions": {
|
||||
"useCopyBuffer": false,
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5,
|
||||
"multilineCompletions": "always"
|
||||
}
|
||||
```
|
||||
|
||||
- `useCopyBuffer`: Determines if the clipboard content should be considered in prompt construction.
|
||||
- `maxPromptTokens`: Sets the maximum number of tokens for the prompt, balancing context and speed.
|
||||
- `prefixPercentage`: Defines the proportion of the prompt dedicated to the code before the cursor.
|
||||
- `multilineCompletions`: Controls whether suggestions can span multiple lines ("always", "never", or "auto").
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
|
||||
- `disable`: Disable autocomplete (can also be done from IDE settings)
|
||||
- `template`: An optional template string to be used for autocomplete. It will be rendered with the Mustache templating language, and is passed the 'prefix' and 'suffix' variables. (String)
|
||||
- `useCopyBuffer`: Determines whether the copy buffer will be considered when constructing the prompt. (Boolean)
|
||||
- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean)
|
||||
- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number)
|
||||
- `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number)
|
||||
|
|
@ -68,7 +67,6 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number)
|
||||
- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto".
|
||||
- `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes.
|
||||
- `useOtherFiles`: Whether to include context from files outside of the current one. Turning this off should be expected to reduce the accuracy of completions, but might be good for testing.
|
||||
- `disableInFiles`: A list of glob patterns for files in which you want to disable tab autocomplete.
|
||||
|
||||
### Full example
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ Specifies options for tab autocompletion behavior.
|
|||
**Properties:**
|
||||
|
||||
- `disable`: If `true`, disables tab autocomplete (default: `false`).
|
||||
- `useCopyBuffer`: If `true`, includes the copy buffer in the prompt.
|
||||
- `useFileSuffix`: If `true`, includes file suffix in the prompt.
|
||||
- `maxPromptTokens`: Maximum number of tokens for the prompt.
|
||||
- `debounceDelay`: Delay (in ms) before triggering autocomplete.
|
||||
|
|
@ -93,7 +92,6 @@ Specifies options for tab autocompletion behavior.
|
|||
- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`).
|
||||
- `useCache`: If `true`, caches completions.
|
||||
- `onlyMyCode`: If `true`, only includes code within the repository.
|
||||
- `useOtherFiles`: If `true`, includes snippets from other files (default: `true`).
|
||||
- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -9,14 +9,12 @@ Continue 在 [`config.json`](../reference.md) 提供少量的参数,对于你
|
|||
|
||||
```json title="config.json"
|
||||
"tabAutocompleteOptions": {
|
||||
"useCopyBuffer": false,
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5,
|
||||
"multilineCompletions": "always"
|
||||
}
|
||||
```
|
||||
|
||||
- `useCopyBuffer`: 决定剪贴板的内容是否包含在提示词构建中
|
||||
- `maxPromptTokens`: 设置提示词的最大 token 数,平衡上下文和速度
|
||||
- `prefixPercentage`: 决定提示词使用光标前代码的比例
|
||||
- `multilineCompletions`: 控制建议是否可以跨多行 ("always", "never" 或 "auto")
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ ollama run starcoder2:3b
|
|||
|
||||
- `disable`: 禁用自动补全(也可以在 IDE 配置中完成)
|
||||
- `template`: 一个用来自动补全的可选的模板字符串。它使用 Mustache 模板语言渲染,并且传递 'prefix' 和 'suffix' 变量。(字符串)
|
||||
- `useCopyBuffer`: 决定 copy buffer 是否考虑为构建提示词。(布尔型)
|
||||
- `useFileSuffix`: 决定是否使用文件后缀在提示词中。(布尔型)
|
||||
- `maxPromptTokens`: 提示词使用的 token 的最大数量。一个较小的数字生成较快的补全,但是较少的上下文。(数字)
|
||||
- `prefixPercentage`: 输入专注于前缀的百分比。(数字)
|
||||
|
|
@ -69,7 +68,6 @@ ollama run starcoder2:3b
|
|||
- `debounceDelay`: 在按键之后触发自动补全的毫秒延迟。(数字)
|
||||
- `multilineCompletions`: 是否启用多行补全 ("always", "never" 或 "auto") 。默认情况下是 "auto" 。
|
||||
- `useCache`: 是否缓存和重新使用补全,当提示词与前一个相同时。对于测试的目的可能是有用的。
|
||||
- `useOtherFiles`: 是否包含当前文件之外的文件的上下文。关闭这个预期会减少补全的准确性,但是对于测试可能是有用的。
|
||||
- `disableInFiles`: 一个你想要禁用 tab 自动补全的 glob 模式的文件列表。
|
||||
|
||||
### 完整示例
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ Specifies options for tab autocompletion behavior.
|
|||
**Properties:**
|
||||
|
||||
- `disable`: If `true`, disables tab autocomplete (default: `false`).
|
||||
- `useCopyBuffer`: If `true`, includes the copy buffer in the prompt.
|
||||
- `useFileSuffix`: If `true`, includes file suffix in the prompt.
|
||||
- `maxPromptTokens`: Maximum number of tokens for the prompt.
|
||||
- `debounceDelay`: Delay (in ms) before triggering autocomplete.
|
||||
|
|
@ -93,7 +92,6 @@ Specifies options for tab autocompletion behavior.
|
|||
- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`).
|
||||
- `useCache`: If `true`, caches completions.
|
||||
- `onlyMyCode`: If `true`, only includes code within the repository.
|
||||
- `useOtherFiles`: If `true`, includes snippets from other files (default: `true`).
|
||||
- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -1,107 +0,0 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
|
||||
import com.github.continuedev.continueintellijextension.constants.getSessionFilePath
|
||||
import com.github.continuedev.continueintellijextension.constants.getSessionsListPath
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
import java.lang.reflect.Type
|
||||
|
||||
typealias PersistedSessionInfo = MutableMap<String, Any>
|
||||
typealias SessionInfo = MutableMap<String, Any>
|
||||
|
||||
class HistoryManager {
|
||||
private val gson = Gson()
|
||||
|
||||
fun list(): List<PersistedSessionInfo> {
|
||||
val filePath = getSessionsListPath()
|
||||
val file = File(filePath)
|
||||
|
||||
if (!file.exists()) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val reader = FileReader(file)
|
||||
val type: Type = object : TypeToken<List<PersistedSessionInfo>>() {}.type
|
||||
val sessions = gson.fromJson<List<PersistedSessionInfo>>(reader, type)
|
||||
|
||||
return sessions.filter { it["sessionId"] != null }
|
||||
}
|
||||
|
||||
fun delete(sessionId: String) {
|
||||
val sessionFile = getSessionFilePath(sessionId)
|
||||
val file = File(sessionFile)
|
||||
|
||||
if (!file.exists()) {
|
||||
throw Exception("Session file $sessionFile does not exist")
|
||||
}
|
||||
|
||||
file.delete()
|
||||
val sessionsListFile = getSessionsListPath()
|
||||
val sessionsListRaw = FileReader(File(sessionsListFile))
|
||||
|
||||
val type: Type = object : TypeToken<List<SessionInfo>>() {}.type
|
||||
var sessionsList = gson.fromJson<List<SessionInfo>>(sessionsListRaw, type)
|
||||
|
||||
sessionsList = sessionsList.filter { it["sessionId"] != sessionId }
|
||||
|
||||
val writer = FileWriter(sessionsListFile)
|
||||
gson.toJson(sessionsList, writer)
|
||||
writer.close()
|
||||
}
|
||||
|
||||
fun load(sessionId: String): PersistedSessionInfo {
|
||||
val sessionFile = getSessionFilePath(sessionId)
|
||||
val file = File(sessionFile)
|
||||
|
||||
if (!file.exists()) {
|
||||
throw Exception("Session file $sessionFile does not exist")
|
||||
}
|
||||
|
||||
val reader = FileReader(file)
|
||||
val text = reader.readText()
|
||||
val type: Type = object : TypeToken<MutableMap<String, Any>>() {}.type
|
||||
val session = gson.fromJson<MutableMap<String, Any>>(text, type)
|
||||
session["sessionId"] = sessionId
|
||||
return session
|
||||
}
|
||||
|
||||
fun save(session: PersistedSessionInfo) {
|
||||
val writer = FileWriter(getSessionFilePath(session["sessionId"] as String? ?: uuid()))
|
||||
gson.toJson(session, writer)
|
||||
writer.close()
|
||||
|
||||
val sessionsListFilePath = getSessionsListPath()
|
||||
val rawSessionsList = FileReader(File(sessionsListFilePath))
|
||||
|
||||
val type: Type = object : TypeToken<List<SessionInfo>>() {}.type
|
||||
val sessionsList = gson.fromJson<List<MutableMap<String, Any>>>(rawSessionsList, type).toMutableList()
|
||||
|
||||
var found = false
|
||||
for (sessionInfo in sessionsList) {
|
||||
if (sessionInfo["sessionId"] == session["sessionId"]) {
|
||||
sessionInfo["title"] = session["title"] as Any
|
||||
sessionInfo["workspaceDirectory"] = session["workspaceDirectory"] as Any
|
||||
sessionInfo["dateCreated"] = System.currentTimeMillis().toString()
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
val sessionInfo = mutableMapOf(
|
||||
"sessionId" to session["sessionId"],
|
||||
"title" to session["title"],
|
||||
"dateCreated" to System.currentTimeMillis().toString(),
|
||||
"workspaceDirectory" to session["workspaceDirectory"]
|
||||
) as MutableMap<String, Any>
|
||||
sessionsList.add(sessionInfo)
|
||||
}
|
||||
|
||||
val writerList = FileWriter(sessionsListFilePath)
|
||||
gson.toJson(sessionsList, writerList)
|
||||
writerList.close()
|
||||
}
|
||||
}
|
||||
|
|
@ -2791,10 +2791,6 @@
|
|||
"description": "Disable tab autocomplete. This can also be done from the IDE settings.",
|
||||
"default": false
|
||||
},
|
||||
"useCopyBuffer": {
|
||||
"type": "boolean",
|
||||
"description": "Determines whether the copy buffer will be considered when contructing the prompt."
|
||||
},
|
||||
"useFileSuffix": {
|
||||
"type": "boolean",
|
||||
"description": "Determines whether to use the file suffix in the prompt."
|
||||
|
|
@ -2835,10 +2831,6 @@
|
|||
"type": "boolean",
|
||||
"description": "If set to true, Continue will not include any snippets from go to definition unless they are within your repository"
|
||||
},
|
||||
"useOtherFiles": {
|
||||
"type": "boolean",
|
||||
"description": "Defaults to true. If set to false, Continue will not attempt to include snippets from other files."
|
||||
},
|
||||
"disableInFiles": {
|
||||
"description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files.",
|
||||
"type": "array",
|
||||
|
|
|
|||
327
extensions/vscode/package-lock.json
generated
327
extensions/vscode/package-lock.json
generated
|
|
@ -18,7 +18,7 @@
|
|||
"axios": "^1.2.5",
|
||||
"core": "file:../../core",
|
||||
"cors": "^2.8.5",
|
||||
"dbinfoz": "^0.11.0",
|
||||
"dbinfoz": "^0.14.0",
|
||||
"downshift": "^7.6.0",
|
||||
"esbuild": "^0.17.19",
|
||||
"express": "^4.18.2",
|
||||
|
|
@ -109,7 +109,6 @@
|
|||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"comment-json": "^4.2.3",
|
||||
"dbinfoz": "^0.14.0",
|
||||
"diff": "^7.0.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
|
|
@ -246,7 +245,6 @@
|
|||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz",
|
||||
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
|
|
@ -258,7 +256,6 @@
|
|||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz",
|
||||
"integrity": "sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-util": "^1.11.0",
|
||||
|
|
@ -272,7 +269,6 @@
|
|||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.2.tgz",
|
||||
"integrity": "sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.4.0",
|
||||
|
|
@ -286,11 +282,48 @@
|
|||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-http-compat": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.1.2.tgz",
|
||||
"integrity": "sha512-5MnV1yqzZwgNLLjlizsU3QqOeQChkIXw781Fwh1xdAqJR5AA32IUaq6xv1BICJvfbHoa+JYcaij2HFkhLbNTJQ==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-client": "^1.3.0",
|
||||
"@azure/core-rest-pipeline": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-lro": {
|
||||
"version": "2.7.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.7.2.tgz",
|
||||
"integrity": "sha512-0YIpccoX8m/k00O7mDDMdJpbr6mf1yWo2dfmxt5A8XVZVVMz2SSKaEbMCeJRvgQ0IaSlqhjT47p4hVIRRy90xw==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-util": "^1.2.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-paging": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz",
|
||||
"integrity": "sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-rest-pipeline": {
|
||||
"version": "1.17.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.17.0.tgz",
|
||||
"integrity": "sha512-62Vv8nC+uPId3j86XJ0WI+sBf0jlqTqPUFCBNrGtlaUeQUIXWV/D8GE5A1d+Qx8H7OQojn2WguC8kChD6v0shA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.8.0",
|
||||
|
|
@ -309,7 +342,6 @@
|
|||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz",
|
||||
"integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
|
|
@ -321,7 +353,6 @@
|
|||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.11.0.tgz",
|
||||
"integrity": "sha512-DxOSLua+NdpWoSqULhjDyAZTXFdP/LKkqtYuxxz1SCN289zk3OG8UOpnCQAz/tygyACBtWp/BoO72ptK7msY8g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
|
|
@ -334,7 +365,6 @@
|
|||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.5.0.tgz",
|
||||
"integrity": "sha512-EknvVmtBuSIic47xkOqyNabAme0RYTw52BTMz8eBgU1ysTyMrD1uOoM+JdS0J/4Yfp98IBT3osqq3BfwSaNaGQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.9.0",
|
||||
|
|
@ -355,11 +385,50 @@
|
|||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/keyvault-common": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/keyvault-common/-/keyvault-common-2.0.0.tgz",
|
||||
"integrity": "sha512-wRLVaroQtOqfg60cxkzUkGKrKMsCP6uYXAOomOIysSMyt1/YM0eUn9LqieAWM8DLcU4+07Fio2YGpPeqUbpP9w==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-client": "^1.5.0",
|
||||
"@azure/core-rest-pipeline": "^1.8.0",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.10.0",
|
||||
"@azure/logger": "^1.1.4",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/keyvault-keys": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/keyvault-keys/-/keyvault-keys-4.9.0.tgz",
|
||||
"integrity": "sha512-ZBP07+K4Pj3kS4TF4XdkqFcspWwBHry3vJSOFM5k5ZABvf7JfiMonvaFk2nBF6xjlEbMpz5PE1g45iTMme0raQ==",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-client": "^1.5.0",
|
||||
"@azure/core-http-compat": "^2.0.1",
|
||||
"@azure/core-lro": "^2.2.0",
|
||||
"@azure/core-paging": "^1.1.1",
|
||||
"@azure/core-rest-pipeline": "^1.8.1",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.0.0",
|
||||
"@azure/keyvault-common": "^2.0.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/logger": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.1.4.tgz",
|
||||
"integrity": "sha512-4IXXzcCdLdlXuCG+8UKEwLA1T1NHqUfanhXYHiQTn+6sfWCZXduqbtXDGceg3Ce5QxTGo7EqmbV6Bi+aqKuClQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
|
|
@ -371,7 +440,6 @@
|
|||
"version": "3.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-3.27.0.tgz",
|
||||
"integrity": "sha512-+b4ZKSD8+vslCtVRVetkegEhOFMLP3rxDWJY212ct+2r6jVg6OSQKc1Qz3kCoXo0FgwaXkb+76TMZfpHp8QtgA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "14.16.0"
|
||||
},
|
||||
|
|
@ -383,7 +451,6 @@
|
|||
"version": "14.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.16.0.tgz",
|
||||
"integrity": "sha512-1KOZj9IpcDSwpNiQNjt0jDYZpQvNZay7QAEi/5DLubay40iGYtLzya/jbjRPLyOTZhEKyL1MzPuw2HqBCjceYA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
|
|
@ -392,7 +459,6 @@
|
|||
"version": "2.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.16.0.tgz",
|
||||
"integrity": "sha512-oww0oJTOOvPKTVXqVyxfcFVjExQKYEkKR5KM0cTG3jnzt6u/MRMx8XaK49L/bxV35r9sCHQFjNlEShad9qGSYA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "14.16.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
|
|
@ -406,7 +472,6 @@
|
|||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
|
|
@ -1204,6 +1269,11 @@
|
|||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@js-joda/core": {
|
||||
"version": "5.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@js-joda/core/-/core-5.6.3.tgz",
|
||||
"integrity": "sha512-T1rRxzdqkEXcou0ZprN1q9yDRlvzCPLqmlNt5IIsGBzoEVgLCCYrKEwc84+TvsXuAc95VAZwtWD2zVsKPY4bcA=="
|
||||
},
|
||||
"node_modules/@jsdevtools/ono": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz",
|
||||
|
|
@ -1765,6 +1835,11 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tediousjs/connection-string": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@tediousjs/connection-string/-/connection-string-0.5.0.tgz",
|
||||
"integrity": "sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ=="
|
||||
},
|
||||
"node_modules/@tootallnate/once": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
|
||||
|
|
@ -2035,6 +2110,20 @@
|
|||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/readable-stream": {
|
||||
"version": "4.0.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.18.tgz",
|
||||
"integrity": "sha512-21jK/1j+Wg+7jVw1xnSwy/2Q1VgVjWuFssbYGTREPUBeZ+rqVFl2udq0IkxzPC0ZhOzVceUbyIACFZKLqKEBlA==",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"safe-buffer": "~5.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/readable-stream/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"node_modules/@types/request": {
|
||||
"version": "2.48.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.12.tgz",
|
||||
|
|
@ -2751,6 +2840,17 @@
|
|||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
|
|
@ -3299,8 +3399,7 @@
|
|||
"node_modules/buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
|
|
@ -4215,10 +4314,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/dbinfoz": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.11.0.tgz",
|
||||
"integrity": "sha512-l7REBd9pwTBI6PWSk/dx+zCpSE2tiJdSKfApeoOajnSgyMJgkwGfhpPO2mV76MLQeKPaSm0mMKxmoqd38SaHmw==",
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.14.0.tgz",
|
||||
"integrity": "sha512-8NLjmj3gEyxbMu1ZwPEby77QvoEkk5NrHKSwX4oSKeaREherwuSx1y08cXmxBEjrSmvByUX9axoKscuilSXfmg==",
|
||||
"dependencies": {
|
||||
"mssql": "^11.0.1",
|
||||
"mysql2": "^3.9.1",
|
||||
"pg": "^8.11.3",
|
||||
"sqlite3": "^5.1.7"
|
||||
|
|
@ -4347,7 +4447,6 @@
|
|||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
|
||||
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
|
|
@ -4565,7 +4664,6 @@
|
|||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
|
|
@ -5095,6 +5193,14 @@
|
|||
"es5-ext": "~0.10.14"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||
|
|
@ -5104,7 +5210,6 @@
|
|||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.x"
|
||||
}
|
||||
|
|
@ -6532,7 +6637,6 @@
|
|||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
|
|
@ -6658,7 +6762,6 @@
|
|||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
|
|
@ -6712,6 +6815,11 @@
|
|||
"jiti": "bin/jiti.js"
|
||||
}
|
||||
},
|
||||
"node_modules/js-md4": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-md4/-/js-md4-0.3.2.tgz",
|
||||
"integrity": "sha512-/GDnfQYsltsjRswQhN9fhv3EMw2sCpUdrdxyWDOUK7eyD++r3gRhzgiQgc/x4MAv2i1iuQ4lxO5mvqM3vj4bwA=="
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
|
|
@ -6907,7 +7015,6 @@
|
|||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
|
||||
"integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"jws": "^3.2.2",
|
||||
"lodash.includes": "^4.3.0",
|
||||
|
|
@ -6929,7 +7036,6 @@
|
|||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
|
||||
"integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
|
|
@ -6940,7 +7046,6 @@
|
|||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
|
||||
"integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"jwa": "^1.4.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
|
|
@ -6975,7 +7080,6 @@
|
|||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz",
|
||||
"integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
|
|
@ -6986,7 +7090,6 @@
|
|||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz",
|
||||
"integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"jwa": "^2.0.0",
|
||||
"safe-buffer": "^5.0.1"
|
||||
|
|
@ -7100,38 +7203,32 @@
|
|||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
|
||||
"dev": true
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
|
||||
},
|
||||
"node_modules/lodash.isboolean": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
|
||||
},
|
||||
"node_modules/lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
|
||||
},
|
||||
"node_modules/lodash.isnumber": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
|
||||
},
|
||||
"node_modules/lodash.isstring": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
|
|
@ -7142,8 +7239,7 @@
|
|||
"node_modules/lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
|
||||
},
|
||||
"node_modules/log-symbols": {
|
||||
"version": "4.1.0",
|
||||
|
|
@ -8247,6 +8343,33 @@
|
|||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/mssql": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mssql/-/mssql-11.0.1.tgz",
|
||||
"integrity": "sha512-KlGNsugoT90enKlR8/G36H0kTxPthDhmtNUCwEHvgRza5Cjpjoj+P2X6eMpFUDN7pFrJZsKadL4x990G8RBE1w==",
|
||||
"dependencies": {
|
||||
"@tediousjs/connection-string": "^0.5.0",
|
||||
"commander": "^11.0.0",
|
||||
"debug": "^4.3.3",
|
||||
"rfdc": "^1.3.0",
|
||||
"tarn": "^3.0.2",
|
||||
"tedious": "^18.2.1"
|
||||
},
|
||||
"bin": {
|
||||
"mssql": "bin/mssql"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/mssql/node_modules/commander": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/mute-stream": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
|
||||
|
|
@ -8323,6 +8446,11 @@
|
|||
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
|
||||
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
||||
},
|
||||
"node_modules/native-duplexpair": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/native-duplexpair/-/native-duplexpair-1.0.0.tgz",
|
||||
"integrity": "sha512-E7QQoM+3jvNtlmyfqRZ0/U75VFgCls+fSkbml2MpgWkWyz3ox8Y58gNhfuziuQYGNNQAbFZJQck55LHCnCK6CA=="
|
||||
},
|
||||
"node_modules/natural-compare": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
|
|
@ -8850,7 +8978,6 @@
|
|||
"version": "8.4.2",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
|
||||
"integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"define-lazy-prop": "^2.0.0",
|
||||
"is-docker": "^2.1.1",
|
||||
|
|
@ -9642,6 +9769,14 @@
|
|||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/process-exists": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/process-exists/-/process-exists-4.1.0.tgz",
|
||||
|
|
@ -10320,6 +10455,11 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/rfdc": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
|
||||
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "5.0.10",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz",
|
||||
|
|
@ -10986,7 +11126,6 @@
|
|||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
|
||||
"integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4",
|
||||
"npm": ">=6"
|
||||
|
|
@ -11424,6 +11563,14 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/tarn": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz",
|
||||
"integrity": "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/taskkill": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/taskkill/-/taskkill-4.0.0.tgz",
|
||||
|
|
@ -11439,6 +11586,91 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious": {
|
||||
"version": "18.6.1",
|
||||
"resolved": "https://registry.npmjs.org/tedious/-/tedious-18.6.1.tgz",
|
||||
"integrity": "sha512-9AvErXXQTd6l7TDd5EmM+nxbOGyhnmdbp/8c3pw+tjaiSXW9usME90ET/CRG1LN1Y9tPMtz/p83z4Q97B4DDpw==",
|
||||
"dependencies": {
|
||||
"@azure/core-auth": "^1.7.2",
|
||||
"@azure/identity": "^4.2.1",
|
||||
"@azure/keyvault-keys": "^4.4.0",
|
||||
"@js-joda/core": "^5.6.1",
|
||||
"@types/node": ">=18",
|
||||
"bl": "^6.0.11",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"js-md4": "^0.3.2",
|
||||
"native-duplexpair": "^1.0.0",
|
||||
"sprintf-js": "^1.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious/node_modules/@types/node": {
|
||||
"version": "22.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.0.tgz",
|
||||
"integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious/node_modules/bl": {
|
||||
"version": "6.0.16",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-6.0.16.tgz",
|
||||
"integrity": "sha512-V/kz+z2Mx5/6qDfRCilmrukUXcXuCoXKg3/3hDvzKKoSUx8CJKudfIoT29XZc3UE9xBvxs5qictiHdprwtteEg==",
|
||||
"dependencies": {
|
||||
"@types/readable-stream": "^4.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious/node_modules/buffer": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
||||
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious/node_modules/readable-stream": {
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
|
||||
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
|
||||
"dependencies": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"events": "^3.3.0",
|
||||
"process": "^0.11.10",
|
||||
"string_decoder": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tedious/node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/text-table": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||
|
|
@ -11746,6 +11978,11 @@
|
|||
"node": ">=18.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="
|
||||
},
|
||||
"node_modules/unified": {
|
||||
"version": "10.1.2",
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.235",
|
||||
"version": "0.9.236",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
"group": "Continue"
|
||||
},
|
||||
{
|
||||
"command": "continue.quickEdit",
|
||||
"command": "continue.focusEdit",
|
||||
"category": "Continue",
|
||||
"title": "Generate Code",
|
||||
"group": "Continue"
|
||||
|
|
@ -651,7 +651,7 @@
|
|||
"axios": "^1.2.5",
|
||||
"core": "file:../../core",
|
||||
"cors": "^2.8.5",
|
||||
"dbinfoz": "^0.11.0",
|
||||
"dbinfoz": "^0.14.0",
|
||||
"downshift": "^7.6.0",
|
||||
"esbuild": "^0.17.19",
|
||||
"express": "^4.18.2",
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import type {
|
|||
RangeInFile,
|
||||
Thread,
|
||||
} from "core";
|
||||
import { text } from "stream/consumers";
|
||||
|
||||
class VsCodeIde implements IDE {
|
||||
ideUtils: VsCodeIdeUtils;
|
||||
|
|
@ -312,7 +311,7 @@ class VsCodeIde implements IDE {
|
|||
return Promise.resolve(vscode.env.machineId);
|
||||
}
|
||||
|
||||
async getDiff(includeUnstaged: boolean): Promise<string> {
|
||||
async getDiff(includeUnstaged: boolean): Promise<string[]> {
|
||||
return await this.ideUtils.getDiff(includeUnstaged);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export class ContinueCompletionProvider
|
|||
e.message,
|
||||
this.configHandler.reloadConfig.bind(this.configHandler),
|
||||
() => {
|
||||
void this.webviewProtocol.request("openOnboardingCard", undefined)
|
||||
void this.webviewProtocol.request("openOnboardingCard", undefined);
|
||||
},
|
||||
);
|
||||
return;
|
||||
|
|
@ -153,12 +153,6 @@ export class ContinueCompletionProvider
|
|||
const signal = abortController.signal;
|
||||
token.onCancellationRequested(() => abortController.abort());
|
||||
|
||||
const config = await this.configHandler.loadConfig();
|
||||
let clipboardText = "";
|
||||
if (config.tabAutocompleteOptions?.useCopyBuffer === true) {
|
||||
clipboardText = await vscode.env.clipboard.readText();
|
||||
}
|
||||
|
||||
// Handle notebook cells
|
||||
const pos = {
|
||||
line: position.line,
|
||||
|
|
@ -194,12 +188,6 @@ export class ContinueCompletionProvider
|
|||
}
|
||||
// Handle commit message input box
|
||||
let manuallyPassPrefix: string | undefined = undefined;
|
||||
if (document.uri.scheme === "vscode-scm") {
|
||||
return null;
|
||||
// let diff = await this.ide.getDiff();
|
||||
// diff = diff.split("\n").splice(-150).join("\n");
|
||||
// manuallyPassPrefix = `${diff}\n\nCommit message: `;
|
||||
}
|
||||
|
||||
const input: AutocompleteInput = {
|
||||
completionId: uuidv4(),
|
||||
|
|
@ -208,7 +196,6 @@ export class ContinueCompletionProvider
|
|||
recentlyEditedFiles: [],
|
||||
recentlyEditedRanges:
|
||||
await this.recentlyEditedTracker.getRecentlyEditedRanges(),
|
||||
clipboardText: clipboardText,
|
||||
manuallyPassFileContents,
|
||||
manuallyPassPrefix,
|
||||
selectedCompletionInfo,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import { GetLspDefinitionsFunction } from "core/autocomplete/CompletionProvider";
|
||||
import { AutocompleteLanguageInfo } from "core/autocomplete/constants/AutocompleteLanguageInfo";
|
||||
import { AutocompleteSnippet } from "core/autocomplete/context/ranking";
|
||||
import { getAst, getTreePathAtCursor } from "core/autocomplete/util/ast";
|
||||
import {
|
||||
FUNCTION_BLOCK_NODE_TYPES,
|
||||
|
|
@ -11,6 +9,14 @@ import * as vscode from "vscode";
|
|||
|
||||
import type { IDE, Range, RangeInFile, RangeInFileWithContents } from "core";
|
||||
import type Parser from "web-tree-sitter";
|
||||
import {
|
||||
AutocompleteSnippetDeprecated,
|
||||
GetLspDefinitionsFunction,
|
||||
} from "core/autocomplete/types";
|
||||
import {
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteSnippetType,
|
||||
} from "core/autocomplete/snippets/types";
|
||||
|
||||
type GotoProviderName =
|
||||
| "vscode.executeDefinitionProvider"
|
||||
|
|
@ -341,7 +347,7 @@ export const getDefinitionsFromLsp: GetLspDefinitionsFunction = async (
|
|||
cursorIndex: number,
|
||||
ide: IDE,
|
||||
lang: AutocompleteLanguageInfo,
|
||||
): Promise<AutocompleteSnippet[]> => {
|
||||
): Promise<AutocompleteCodeSnippet[]> => {
|
||||
try {
|
||||
const ast = await getAst(filepath, contents);
|
||||
if (!ast) {
|
||||
|
|
@ -365,8 +371,9 @@ export const getDefinitionsFromLsp: GetLspDefinitionsFunction = async (
|
|||
}
|
||||
|
||||
return results.map((result) => ({
|
||||
...result,
|
||||
score: 0.8,
|
||||
filepath: result.filepath,
|
||||
content: result.contents,
|
||||
type: AutocompleteSnippetType.Code,
|
||||
}));
|
||||
} catch (e) {
|
||||
console.warn("Error getting definitions from LSP: ", e);
|
||||
|
|
|
|||
|
|
@ -93,19 +93,44 @@ function addCodeToContextFromRange(
|
|||
});
|
||||
}
|
||||
|
||||
function getCurrentlyHighlightedCode(
|
||||
function getRangeInFileWithContents(
|
||||
allowEmpty?: boolean,
|
||||
range?: vscode.Range,
|
||||
): RangeInFileWithContents | null {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
||||
if (editor) {
|
||||
const selection = editor.selection;
|
||||
const filepath = editor.document.uri.fsPath;
|
||||
|
||||
if (range) {
|
||||
const contents = editor.document.getText(range);
|
||||
|
||||
return {
|
||||
range: {
|
||||
start: {
|
||||
line: range.start.line,
|
||||
character: range.start.character,
|
||||
},
|
||||
end: {
|
||||
line: range.end.line,
|
||||
character: range.end.character,
|
||||
},
|
||||
},
|
||||
filepath,
|
||||
contents,
|
||||
};
|
||||
}
|
||||
|
||||
if (selection.isEmpty && !allowEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// adjust starting position to include indentation
|
||||
const start = new vscode.Position(selection.start.line, 0);
|
||||
const range = new vscode.Range(start, selection.end);
|
||||
const contents = editor.document.getText(range);
|
||||
const selectionRange = new vscode.Range(start, selection.end);
|
||||
const contents = editor.document.getText(selectionRange);
|
||||
|
||||
return {
|
||||
filepath: editor.document.uri.fsPath,
|
||||
contents,
|
||||
|
|
@ -121,13 +146,14 @@ function getCurrentlyHighlightedCode(
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function addHighlightedCodeToContext(
|
||||
webviewProtocol: VsCodeWebviewProtocol | undefined,
|
||||
) {
|
||||
const rangeInFileWithContents = getCurrentlyHighlightedCode();
|
||||
const rangeInFileWithContents = getRangeInFileWithContents();
|
||||
if (rangeInFileWithContents) {
|
||||
webviewProtocol?.request("highlightedCode", {
|
||||
rangeInFileWithContents,
|
||||
|
|
@ -375,7 +401,7 @@ const getCommandsMap: (
|
|||
// Passthrough for telemetry purposes
|
||||
"continue.defaultQuickAction": async (args: QuickEditShowParams) => {
|
||||
captureCommandTelemetry("defaultQuickAction");
|
||||
vscode.commands.executeCommand("continue.quickEdit", args);
|
||||
vscode.commands.executeCommand("continue.focusEdit", args);
|
||||
},
|
||||
"continue.customQuickActionSendToChat": async (
|
||||
prompt: string,
|
||||
|
|
@ -467,7 +493,9 @@ const getCommandsMap: (
|
|||
void addHighlightedCodeToContext(sidebar.webviewProtocol);
|
||||
}
|
||||
},
|
||||
"continue.focusEdit": async () => {
|
||||
// QuickEditShowParams are passed from CodeLens, temp fix
|
||||
// until we update to new params specific to Edit
|
||||
"continue.focusEdit": async (args?: QuickEditShowParams) => {
|
||||
captureCommandTelemetry("focusEdit");
|
||||
focusGUI();
|
||||
|
||||
|
|
@ -489,12 +517,13 @@ const getCommandsMap: (
|
|||
return;
|
||||
}
|
||||
|
||||
editDecorationManager.setDecoration(
|
||||
editor,
|
||||
new vscode.Range(editor.selection.start, editor.selection.end),
|
||||
);
|
||||
const range =
|
||||
args?.range ??
|
||||
new vscode.Range(editor.selection.start, editor.selection.end);
|
||||
|
||||
const rangeInFileWithContents = getCurrentlyHighlightedCode(true);
|
||||
editDecorationManager.setDecoration(editor, range);
|
||||
|
||||
const rangeInFileWithContents = getRangeInFileWithContents(true, range);
|
||||
|
||||
if (rangeInFileWithContents) {
|
||||
sidebar.webviewProtocol?.request(
|
||||
|
|
@ -508,10 +537,6 @@ const getCommandsMap: (
|
|||
editor.selection.anchor,
|
||||
);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
sidebar.webviewProtocol?.request("focusContinueInput", undefined);
|
||||
}, 30);
|
||||
},
|
||||
"continue.focusEditWithoutClear": async () => {
|
||||
captureCommandTelemetry("focusEditWithoutClear");
|
||||
|
|
@ -537,7 +562,7 @@ const getCommandsMap: (
|
|||
return;
|
||||
}
|
||||
|
||||
const rangeInFileWithContents = getCurrentlyHighlightedCode(false);
|
||||
const rangeInFileWithContents = getRangeInFileWithContents(false);
|
||||
|
||||
if (rangeInFileWithContents) {
|
||||
sidebar.webviewProtocol?.request(
|
||||
|
|
@ -553,25 +578,21 @@ const getCommandsMap: (
|
|||
contents,
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
sidebar.webviewProtocol?.request("focusContinueInput", undefined);
|
||||
}, 30);
|
||||
},
|
||||
"continue.exitEditMode": async () => {
|
||||
captureCommandTelemetry("exitEditMode");
|
||||
await sidebar.webviewProtocol?.request("exitEditMode", undefined);
|
||||
},
|
||||
"continue.quickEdit": async (args: QuickEditShowParams) => {
|
||||
let linesOfCode = undefined;
|
||||
if (args.range) {
|
||||
linesOfCode = args.range.end.line - args.range.start.line;
|
||||
}
|
||||
captureCommandTelemetry("quickEdit", {
|
||||
linesOfCode,
|
||||
});
|
||||
quickEdit.show(args);
|
||||
},
|
||||
// "continue.quickEdit": async (args: QuickEditShowParams) => {
|
||||
// let linesOfCode = undefined;
|
||||
// if (args.range) {
|
||||
// linesOfCode = args.range.end.line - args.range.start.line;
|
||||
// }
|
||||
// captureCommandTelemetry("quickEdit", {
|
||||
// linesOfCode,
|
||||
// });
|
||||
// quickEdit.show(args);
|
||||
// },
|
||||
"continue.writeCommentsForCode": async () => {
|
||||
captureCommandTelemetry("writeCommentsForCode");
|
||||
|
||||
|
|
|
|||
|
|
@ -508,6 +508,11 @@ export class VsCodeMessenger {
|
|||
await Promise.all(
|
||||
sessions.map((session) => workOsAuthProvider.removeSession(session.id)),
|
||||
);
|
||||
vscode.commands.executeCommand(
|
||||
"setContext",
|
||||
"continue.isSignedInToControlPlane",
|
||||
false,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,10 @@ class EditDecorationManager {
|
|||
|
||||
constructor(context: vscode.ExtensionContext) {
|
||||
this.decorationType = vscode.window.createTextEditorDecorationType({
|
||||
backgroundColor: "rgba(255, 255, 0, 0.1)",
|
||||
borderWidth: "0 0 0 1px",
|
||||
borderColor: "rgba(255, 255, 0)",
|
||||
borderStyle: "solid",
|
||||
backgroundColor: new vscode.ThemeColor(
|
||||
"editor.inactiveSelectionBackground",
|
||||
),
|
||||
isWholeLine: true,
|
||||
cursor: "pointer",
|
||||
// gutterIconPath: context.asAbsolutePath("media/gutterIcon.png"),
|
||||
gutterIconSize: "contain",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ describe("IDE Utils", () => {
|
|||
|
||||
test("noDiff", async () => {
|
||||
const noDiff = await utils.getDiff(false);
|
||||
assert(noDiff === "");
|
||||
assert(noDiff.length === 0);
|
||||
});
|
||||
|
||||
test.skip("getBranch", async () => {
|
||||
|
|
|
|||
|
|
@ -570,8 +570,20 @@ export class VsCodeIdeUtils {
|
|||
return repo?.state?.HEAD?.name || "NONE";
|
||||
}
|
||||
|
||||
async getDiff(includeUnstaged: boolean): Promise<string> {
|
||||
let diffs: string[] = [];
|
||||
private splitDiff(diffString: string): string[] {
|
||||
const fileDiffHeaderRegex = /(?=diff --git a\/.* b\/.*)/;
|
||||
|
||||
const diffs = diffString.split(fileDiffHeaderRegex);
|
||||
|
||||
if (diffs[0].trim() === "") {
|
||||
diffs.shift();
|
||||
}
|
||||
|
||||
return diffs;
|
||||
}
|
||||
|
||||
async getDiff(includeUnstaged: boolean): Promise<string[]> {
|
||||
const diffs: string[] = [];
|
||||
|
||||
for (const dir of this.getWorkspaceDirectories()) {
|
||||
const repo = await this.getRepo(vscode.Uri.file(dir));
|
||||
|
|
@ -587,9 +599,7 @@ export class VsCodeIdeUtils {
|
|||
}
|
||||
}
|
||||
|
||||
const fullDiff = diffs.join("\n\n");
|
||||
|
||||
return fullDiff;
|
||||
return diffs.flatMap((diff) => this.splitDiff(diff));
|
||||
}
|
||||
|
||||
getHighlightedCode(): RangeInFile[] {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { VscThemeProvider } from "./context/VscTheme";
|
|||
import useSetup from "./hooks/useSetup";
|
||||
import { AddNewModel, ConfigureProvider } from "./pages/AddNewModel";
|
||||
import ConfigErrorPage from "./pages/config-error";
|
||||
import Edit from "./pages/Edit";
|
||||
import Edit from "./pages/edit";
|
||||
import ErrorPage from "./pages/error";
|
||||
import Chat from "./pages/gui";
|
||||
import History from "./pages/history";
|
||||
|
|
|
|||
|
|
@ -134,12 +134,12 @@ function AccountDialog() {
|
|||
? "Signed in"
|
||||
: `Signed in as ${session.account.label}`}
|
||||
</p>
|
||||
<NewSessionButton className="border border-solid" onClick={logout}>
|
||||
Sign out
|
||||
</NewSessionButton>
|
||||
<div className="mt-3 flex flex-row">
|
||||
<div className="mt-3 flex flex-row justify-between gap-2">
|
||||
<SecondaryButton className="max-w-20 flex-1" onClick={logout}>
|
||||
Sign out
|
||||
</SecondaryButton>
|
||||
<Button
|
||||
className="basis-1/4"
|
||||
className="max-w-20 flex-1"
|
||||
onClick={() => {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { PencilSquareIcon, TrashIcon } from "@heroicons/react/24/outline";
|
||||
import { SessionInfo } from "core";
|
||||
import { SessionMetadata } from "core";
|
||||
import React, { useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Input } from "..";
|
||||
import useHistory from "../../hooks/useHistory";
|
||||
import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip";
|
||||
import { RootState } from "../../redux/store";
|
||||
import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip";
|
||||
|
||||
function lastPartOfPath(path: string): string {
|
||||
const sep = path.includes("/") ? "/" : "\\";
|
||||
|
|
@ -14,13 +14,15 @@ function lastPartOfPath(path: string): string {
|
|||
}
|
||||
|
||||
export function HistoryTableRow({
|
||||
session,
|
||||
sessionMetadata,
|
||||
date,
|
||||
onDelete,
|
||||
onEdit,
|
||||
}: {
|
||||
session: SessionInfo;
|
||||
sessionMetadata: SessionMetadata;
|
||||
date: Date;
|
||||
onDelete: (sessionId: string) => void;
|
||||
onEdit: (session: SessionMetadata) => void;
|
||||
}) {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -28,7 +30,7 @@ export function HistoryTableRow({
|
|||
const [hovered, setHovered] = useState(false);
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [sessionTitleEditValue, setSessionTitleEditValue] = useState(
|
||||
session.title,
|
||||
sessionMetadata.title,
|
||||
);
|
||||
const currentSessionId = useSelector(
|
||||
(state: RootState) => state.state.sessionId,
|
||||
|
|
@ -39,16 +41,19 @@ export function HistoryTableRow({
|
|||
|
||||
const handleKeyUp = async (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === "Enter") {
|
||||
if (sessionTitleEditValue !== session.title) {
|
||||
session.title = sessionTitleEditValue;
|
||||
const persistedSessionInfo = await getSession(session.sessionId);
|
||||
persistedSessionInfo.title = sessionTitleEditValue;
|
||||
await updateSession(persistedSessionInfo);
|
||||
if (sessionTitleEditValue !== sessionMetadata.title) {
|
||||
const sessionData = await getSession(sessionMetadata.sessionId);
|
||||
sessionData.title = sessionTitleEditValue;
|
||||
await updateSession(sessionData);
|
||||
onEdit({
|
||||
...sessionMetadata,
|
||||
title: sessionTitleEditValue,
|
||||
});
|
||||
}
|
||||
setEditing(false);
|
||||
} else if (e.key === "Escape") {
|
||||
setEditing(false);
|
||||
setSessionTitleEditValue(session.title);
|
||||
setSessionTitleEditValue(sessionMetadata.title);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -63,9 +68,9 @@ export function HistoryTableRow({
|
|||
className="hover:bg-vsc-editor-background relative box-border flex max-w-full cursor-pointer overflow-hidden rounded-lg p-3"
|
||||
onClick={async () => {
|
||||
// Save current session
|
||||
if (session.sessionId !== currentSessionId) {
|
||||
if (sessionMetadata.sessionId !== currentSessionId) {
|
||||
await saveSession();
|
||||
await loadSession(session.sessionId);
|
||||
await loadSession(sessionMetadata.sessionId);
|
||||
}
|
||||
|
||||
navigate("/");
|
||||
|
|
@ -86,12 +91,14 @@ export function HistoryTableRow({
|
|||
</div>
|
||||
) : (
|
||||
<span className="text-md block max-w-80 truncate text-base font-semibold">
|
||||
{JSON.stringify(session.title).slice(1, -1)}
|
||||
{JSON.stringify(sessionMetadata.title).slice(1, -1)}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="flex" style={{ color: "#9ca3af" }}>
|
||||
<span>{lastPartOfPath(session.workspaceDirectory || "")}</span>
|
||||
<span>
|
||||
{lastPartOfPath(sessionMetadata.workspaceDirectory || "")}
|
||||
</span>
|
||||
{/* Uncomment to show the date */}
|
||||
{/* <span className="inline-block ml-auto">
|
||||
{date.toLocaleString("en-US", {
|
||||
|
|
@ -119,9 +126,10 @@ export function HistoryTableRow({
|
|||
</HeaderButtonWithToolTip>
|
||||
<HeaderButtonWithToolTip
|
||||
text="Delete"
|
||||
onClick={async () => {
|
||||
await deleteSession(session.sessionId);
|
||||
onDelete(session.sessionId);
|
||||
onClick={async (e) => {
|
||||
e.stopPropagation();
|
||||
await deleteSession(sessionMetadata.sessionId);
|
||||
onDelete(sessionMetadata.sessionId);
|
||||
}}
|
||||
>
|
||||
<TrashIcon width="1.3em" height="1.3em" />
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { SessionInfo } from "core";
|
||||
import { SessionMetadata } from "core";
|
||||
import MiniSearch from "minisearch";
|
||||
import React, { Fragment, useEffect, useMemo, useState } from "react";
|
||||
import React, { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
import useHistory from "../../hooks/useHistory";
|
||||
import { getFontSize } from "../../util";
|
||||
import { getFontSize, getMetaKeyLabel } from "../../util";
|
||||
import { HistoryTableRow } from "./HistoryTableRow";
|
||||
import { XMarkIcon } from "@heroicons/react/24/solid";
|
||||
|
||||
|
|
@ -20,13 +20,7 @@ const HEADER_CLASS =
|
|||
"flex user-select-none pt-2 pb-3 opacity-75 text-center font-bold items-center justify-center sticky h-6";
|
||||
|
||||
export function History() {
|
||||
const [sessions, setSessions] = useState<SessionInfo[]>([]);
|
||||
|
||||
const deleteSessionInUI = async (sessionId: string) => {
|
||||
setSessions((prev) =>
|
||||
prev.filter((session) => session.sessionId !== sessionId),
|
||||
);
|
||||
};
|
||||
const [sessions, setSessions] = useState<SessionMetadata[]>([]);
|
||||
|
||||
const searchInputRef = React.useRef<HTMLInputElement>(null);
|
||||
|
||||
|
|
@ -35,12 +29,12 @@ export function History() {
|
|||
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
|
||||
const minisearch = useMemo(() => {
|
||||
return new MiniSearch({
|
||||
const minisearch = useRef<MiniSearch>(
|
||||
new MiniSearch({
|
||||
fields: ["title"],
|
||||
storeFields: ["title", "sessionId", "id"],
|
||||
});
|
||||
}, []);
|
||||
}),
|
||||
).current;
|
||||
|
||||
useEffect(() => {
|
||||
const fetchSessions = async () => {
|
||||
|
|
@ -64,7 +58,27 @@ export function History() {
|
|||
fetchSessions();
|
||||
}, [lastSessionId]);
|
||||
|
||||
const filteredAndSortedSessions: SessionInfo[] = useMemo(() => {
|
||||
const deleteSessionInUI = async (sessionId: string) => {
|
||||
setSessions((prev) =>
|
||||
prev.filter((session) => session.sessionId !== sessionId),
|
||||
);
|
||||
minisearch.discard(sessionId);
|
||||
};
|
||||
|
||||
const updateSessionInUI = async (session: SessionMetadata) => {
|
||||
setSessions((prev) =>
|
||||
prev.map((sess) =>
|
||||
sess.sessionId === session.sessionId ? session : sess,
|
||||
),
|
||||
);
|
||||
minisearch.replace({
|
||||
title: session.title,
|
||||
sessionId: session.sessionId,
|
||||
id: session.sessionId,
|
||||
});
|
||||
};
|
||||
|
||||
const filteredAndSortedSessions: SessionMetadata[] = useMemo(() => {
|
||||
const sessionIds = minisearch
|
||||
.search(searchTerm, {
|
||||
fuzzy: 0.1,
|
||||
|
|
@ -114,7 +128,9 @@ export function History() {
|
|||
{filteredAndSortedSessions.length === 0 && (
|
||||
<div className="m-4 text-center">
|
||||
No past sessions found. To start a new session, either click the "+"
|
||||
button or use the keyboard shortcut: <b>Option + Command + N</b>
|
||||
button or use the keyboard shortcut: <code>{getMetaKeyLabel()}</code>
|
||||
{` `}
|
||||
<code>L</code>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
@ -152,10 +168,10 @@ export function History() {
|
|||
)}
|
||||
|
||||
<HistoryTableRow
|
||||
key={session.sessionId}
|
||||
session={session}
|
||||
sessionMetadata={session}
|
||||
date={date}
|
||||
onDelete={() => deleteSessionInUI(session.sessionId)}
|
||||
onDelete={deleteSessionInUI}
|
||||
onEdit={updateSessionInUI}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,48 +1,94 @@
|
|||
import {
|
||||
CheckCircleIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
CheckIcon,
|
||||
InformationCircleIcon,
|
||||
PencilIcon,
|
||||
PlusIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { SiteIndexingConfig } from "core";
|
||||
import { IndexingStatus, PackageDocsResult, SiteIndexingConfig } from "core";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
import { useContext, useLayoutEffect, useRef, useState } from "react";
|
||||
import { useContext, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Button, HelperText, Input, lightGray, SecondaryButton } from "..";
|
||||
import { Input, SecondaryButton } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../redux/slices/uiStateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
import IndexingStatusViewer from "../indexing/IndexingStatus";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
import FileIcon from "../FileIcon";
|
||||
import DocsIndexingPeeks from "../indexing/DocsIndexingPeeks";
|
||||
import { updateIndexingStatus } from "../../redux/slices/stateSlice";
|
||||
import preIndexedDocs from "core/indexing/docs/preIndexedDocs";
|
||||
|
||||
function AddDocsDialog() {
|
||||
const posthog = usePostHog();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const ref = useRef<HTMLInputElement>(null);
|
||||
const titleRef = useRef<HTMLInputElement>(null);
|
||||
const urlRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const [title, setTitle] = useState("");
|
||||
const [startUrl, setStartUrl] = useState("");
|
||||
const [faviconUrl, setFaviconUrl] = useState("");
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const [submittedConfig, setSubmittedConfig] = useState<SiteIndexingConfig>();
|
||||
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const indexingStatuses = useSelector(
|
||||
(store: RootState) => store.state.indexing.statuses,
|
||||
);
|
||||
|
||||
const docsIndexingStatuses: IndexingStatus[] = useMemo(() => {
|
||||
return Object.values(indexingStatuses).filter(
|
||||
(status) => status.type === "docs" && status.status === "indexing",
|
||||
);
|
||||
}, [indexingStatuses]);
|
||||
|
||||
const docsSuggestions = useSelector(
|
||||
(store: RootState) => store.state.docsSuggestions,
|
||||
);
|
||||
|
||||
const configDocs = useSelector((store: RootState) => store.state.config.docs);
|
||||
|
||||
const sortedDocsSuggestions = useMemo(() => {
|
||||
const docsFromConfig = configDocs ?? [];
|
||||
const filtered = docsSuggestions.filter((sug) => {
|
||||
const startUrl = sug.details?.docsLink;
|
||||
return (
|
||||
!docsFromConfig.find((d) => d.startUrl === startUrl) &&
|
||||
!docsIndexingStatuses.find((s) => s.id === startUrl) &&
|
||||
(startUrl ? !preIndexedDocs[startUrl] : true)
|
||||
);
|
||||
});
|
||||
|
||||
filtered.sort((a, b) => {
|
||||
const rank = (result: PackageDocsResult) => {
|
||||
if (result.error) {
|
||||
return 2;
|
||||
} else if (result.details?.docsLinkWarning) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
return rank(a) - rank(b);
|
||||
});
|
||||
return filtered;
|
||||
}, [docsSuggestions, configDocs, docsIndexingStatuses]);
|
||||
|
||||
const isFormValid = startUrl && title;
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setTimeout(() => {
|
||||
if (ref.current) {
|
||||
ref.current.focus();
|
||||
if (titleRef.current) {
|
||||
titleRef.current.focus();
|
||||
}
|
||||
}, 100);
|
||||
}, [ref]);
|
||||
}, [titleRef]);
|
||||
|
||||
const closeDialog = () => {
|
||||
dispatch(setShowDialog(false));
|
||||
dispatch(setDialogMessage(undefined));
|
||||
};
|
||||
|
||||
function onSubmit(e: any) {
|
||||
e.preventDefault();
|
||||
|
|
@ -55,158 +101,228 @@ function AddDocsDialog() {
|
|||
|
||||
ideMessenger.post("context/addDocs", siteIndexingConfig);
|
||||
|
||||
setSubmittedConfig(siteIndexingConfig);
|
||||
setTitle("");
|
||||
setStartUrl("");
|
||||
setFaviconUrl("");
|
||||
|
||||
posthog.capture("add_docs_gui", { url: startUrl });
|
||||
}
|
||||
|
||||
if (submittedConfig) {
|
||||
const status = indexingStatuses[submittedConfig.startUrl];
|
||||
return (
|
||||
<div className="flex flex-col p-4">
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<CheckCircleIcon className="h-8 w-8" />
|
||||
<h1>{`Docs added`}</h1>
|
||||
</div>
|
||||
<div className="flex flex-col gap-1 text-stone-500">
|
||||
<p className="m-0 p-0">Title: {submittedConfig.title}</p>
|
||||
<p className="m-0 p-0">Start URL: {submittedConfig.startUrl}</p>
|
||||
{submittedConfig.rootUrl && (
|
||||
<p className="m-0 p-0">Root URL: {submittedConfig.rootUrl}</p>
|
||||
)}
|
||||
{submittedConfig.maxDepth && (
|
||||
<p className="m-0 p-0">Max depth: {submittedConfig.maxDepth}</p>
|
||||
)}
|
||||
{submittedConfig.faviconUrl && (
|
||||
<p className="m-0 p-0">Favicon URL: {submittedConfig.faviconUrl}</p>
|
||||
)}
|
||||
</div>
|
||||
{!!status && (
|
||||
<div className="mt-4 flex flex-col divide-x-0 divide-y-2 divide-solid divide-zinc-700">
|
||||
<p className="m-0 mb-5 p-0 leading-snug">{`Type "@docs" and select ${submittedConfig.title} to reference these docs once indexing is complete. Check indexing status from the "More" page.`}</p>
|
||||
<div className="pt-1">
|
||||
<IndexingStatusViewer status={status} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-4 flex flex-row items-center justify-end gap-4">
|
||||
<SecondaryButton
|
||||
className=""
|
||||
onClick={() => {
|
||||
setSubmittedConfig(undefined);
|
||||
}}
|
||||
>
|
||||
Add another
|
||||
</SecondaryButton>
|
||||
<Button
|
||||
className=""
|
||||
onClick={() => {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
>
|
||||
Done
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
// Optimistic status update
|
||||
dispatch(
|
||||
updateIndexingStatus({
|
||||
type: "docs",
|
||||
description: "Initializing",
|
||||
id: startUrl,
|
||||
embeddingsProviderId: "mock-embeddings-provider-id",
|
||||
progress: 0,
|
||||
status: "indexing",
|
||||
title,
|
||||
url: startUrl,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const handleSelectSuggestion = (docsResult: PackageDocsResult) => {
|
||||
if (docsResult.error) {
|
||||
setTitle(docsResult.packageInfo.name);
|
||||
setStartUrl("");
|
||||
urlRef.current?.focus();
|
||||
return;
|
||||
}
|
||||
if (docsResult.details?.docsLinkWarning) {
|
||||
setTitle(docsResult.packageInfo.name);
|
||||
setStartUrl(docsResult.details.docsLink);
|
||||
urlRef.current?.focus();
|
||||
return;
|
||||
}
|
||||
const siteIndexingConfig: SiteIndexingConfig = {
|
||||
startUrl: docsResult.details.docsLink,
|
||||
title: docsResult.details.title,
|
||||
faviconUrl: undefined,
|
||||
};
|
||||
|
||||
ideMessenger.post("context/addDocs", siteIndexingConfig);
|
||||
|
||||
posthog.capture("add_docs_gui", { url: startUrl });
|
||||
|
||||
// Optimistic status update
|
||||
dispatch(
|
||||
updateIndexingStatus({
|
||||
type: "docs",
|
||||
description: "Initializing",
|
||||
id: docsResult.details.docsLink,
|
||||
embeddingsProviderId: "mock-embeddings-provider-id",
|
||||
progress: 0,
|
||||
status: "indexing",
|
||||
title: docsResult.details.title ?? docsResult.packageInfo.name,
|
||||
url: docsResult.details.docsLink,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
<div className="mb-8">
|
||||
<h1>Add a documentation site</h1>
|
||||
|
||||
<p>
|
||||
Continue pre-indexes many common documentation sites, but if there's
|
||||
one you don't see in the dropdown, enter the URL here.
|
||||
<div className="px-2 pt-4 sm:px-4">
|
||||
<div className="">
|
||||
<h1 className="mb-0 hidden sm:block">Add documentation</h1>
|
||||
<h1 className="sm:hidden">Add docs</h1>
|
||||
<p className="m-0 mt-2 p-0 text-stone-500">
|
||||
For the @docs context provider
|
||||
</p>
|
||||
{!!sortedDocsSuggestions.length && (
|
||||
<p className="m-0 mb-1 mt-4 p-0 font-semibold">Suggestions</p>
|
||||
)}
|
||||
<div className="border-vsc-foreground-muted max-h-[145px] overflow-y-scroll rounded-sm py-1 pr-2">
|
||||
{sortedDocsSuggestions.map((docsResult) => {
|
||||
const { error, details } = docsResult;
|
||||
const { language, name, version } = docsResult.packageInfo;
|
||||
const id = `${language}-${name}-${version}`;
|
||||
return (
|
||||
<div
|
||||
key={id}
|
||||
className="grid cursor-pointer grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto] items-center px-1 py-1 hover:bg-gray-200/10"
|
||||
onClick={() => {
|
||||
handleSelectSuggestion(docsResult);
|
||||
}}
|
||||
>
|
||||
<div className="pr-1">
|
||||
{error || details.docsLinkWarning ? (
|
||||
<div>
|
||||
<PencilIcon
|
||||
data-tooltip-id={id + "-edit"}
|
||||
className="vsc-foreground-muted h-3 w-3"
|
||||
/>
|
||||
<ToolTip id={id + "-edit"} place="bottom">
|
||||
This may not be a docs page
|
||||
</ToolTip>
|
||||
</div>
|
||||
) : (
|
||||
<PlusIcon className="text-foreground-muted h-3.5 w-3.5" />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-0.5">
|
||||
<div className="hidden sm:block">
|
||||
<FileIcon
|
||||
filename={`x.${language}`}
|
||||
height="1rem"
|
||||
width="1rem"
|
||||
/>
|
||||
</div>
|
||||
<span className="lines lines-1">{name}</span>
|
||||
</div>
|
||||
<div>
|
||||
{error ? (
|
||||
<span className="text-vsc-foreground-muted italic">
|
||||
No docs link found
|
||||
</span>
|
||||
) : (
|
||||
<div className="flex items-center gap-2">
|
||||
{/* <div>
|
||||
<LinkIcon className="h-2 w-2" />
|
||||
</div> */}
|
||||
<p className="lines lines-1 m-0 p-0">
|
||||
{details.docsLink}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<InformationCircleIcon
|
||||
data-tooltip-id={id + "-info"}
|
||||
className="text-vsc-foreground-muted h-3.5 w-3.5 select-none"
|
||||
/>
|
||||
<ToolTip id={id + "-info"} place="bottom">
|
||||
<p className="m-0 p-0">{`Version: ${version}`}</p>
|
||||
<p className="m-0 p-0">{`Found in ${docsResult.packageInfo.packageFile.path}`}</p>
|
||||
</ToolTip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<form onSubmit={onSubmit} className="flex flex-col gap-1">
|
||||
<div className="flex flex-row gap-2">
|
||||
<label className="flex min-w-16 basis-1/4 flex-col gap-1">
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
<span>Title</span>
|
||||
<div>
|
||||
<InformationCircleIcon
|
||||
data-tooltip-id={"add-docs-form-title"}
|
||||
className="text-vsc-foreground-muted h-3.5 w-3.5 select-none"
|
||||
/>
|
||||
<ToolTip id={"add-docs-form-title"} place="top">
|
||||
The title that will be displayed to users in the `@docs`
|
||||
submenu
|
||||
</ToolTip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Continue's indexing engine will crawl the site and generate embeddings
|
||||
so that you can ask questions.
|
||||
</p>
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Title"
|
||||
value={title}
|
||||
ref={titleRef}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label className="flex basis-3/4 flex-col gap-1">
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
<span className="lines lines-1 whitespace-nowrap">
|
||||
Start URL
|
||||
</span>
|
||||
<div>
|
||||
<InformationCircleIcon
|
||||
data-tooltip-id={"add-docs-form-url"}
|
||||
className="text-vsc-foreground-muted h-3.5 w-3.5 select-none"
|
||||
/>
|
||||
<ToolTip id={"add-docs-form-url"} place="top">
|
||||
The starting location to begin crawling the documentation
|
||||
site
|
||||
</ToolTip>
|
||||
</div>
|
||||
</div>
|
||||
<Input
|
||||
ref={urlRef}
|
||||
type="url"
|
||||
placeholder="Start URL"
|
||||
value={startUrl}
|
||||
onChange={(e) => {
|
||||
setStartUrl(e.target.value);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
{/* <div>
|
||||
<PlusCircleIcon className="h-5 w-5 self-end" />
|
||||
</div> */}
|
||||
</div>
|
||||
<div className="flex flex-row justify-end gap-2">
|
||||
<SecondaryButton
|
||||
className="min-w-16"
|
||||
disabled={!isFormValid}
|
||||
type="submit"
|
||||
>
|
||||
Add
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={onSubmit} className="flex flex-col space-y-4">
|
||||
<label>
|
||||
Title
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Title"
|
||||
value={title}
|
||||
ref={ref}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
/>
|
||||
<HelperText>
|
||||
The title that will be displayed to users in the `@docs` submenu
|
||||
</HelperText>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Start URL
|
||||
<Input
|
||||
type="url"
|
||||
placeholder="Start URL"
|
||||
value={startUrl}
|
||||
onChange={(e) => {
|
||||
setStartUrl(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<HelperText>
|
||||
The starting location to begin crawling the documentation site
|
||||
</HelperText>
|
||||
</label>
|
||||
|
||||
<div
|
||||
className="cursor-pointer"
|
||||
onClick={() => setIsOpen((prev) => !prev)}
|
||||
>
|
||||
{isOpen ? (
|
||||
<ChevronUpIcon
|
||||
width="1.0em"
|
||||
height="1.0em"
|
||||
style={{ color: lightGray }}
|
||||
></ChevronUpIcon>
|
||||
) : (
|
||||
<ChevronDownIcon
|
||||
width="1.0em"
|
||||
height="1.0em"
|
||||
style={{ color: lightGray }}
|
||||
></ChevronDownIcon>
|
||||
)}
|
||||
<span className="ms-1">Advanced</span>
|
||||
<DocsIndexingPeeks statuses={docsIndexingStatuses} />
|
||||
<div className="flex flex-row items-end justify-between pb-3">
|
||||
<div>
|
||||
{docsIndexingStatuses.length ? (
|
||||
<p className="mt-2 flex flex-row items-center gap-1 p-0 px-1 text-xs text-stone-500">
|
||||
<CheckIcon className="h-3 w-3" />
|
||||
It is safe to close this form while indexing
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{isOpen && (
|
||||
<div className="pt-2">
|
||||
<label>
|
||||
Favicon URL [Optional]
|
||||
<Input
|
||||
type="url"
|
||||
placeholder={`${startUrl}/favicon.ico`}
|
||||
value={faviconUrl}
|
||||
onChange={(e) => {
|
||||
setFaviconUrl(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<HelperText>
|
||||
The URL path to a favicon for the site - by default, it will be
|
||||
`/favicon.ico` path from the Start URL
|
||||
</HelperText>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button disabled={!isFormValid} type="submit">
|
||||
Submit
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
{/* <Button className="min-w-16" onClick={closeDialog}>
|
||||
Done
|
||||
</Button> */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const TextDialog = (props: TextDialogProps) => {
|
|||
return (
|
||||
<ScreenCover onClick={props.onClose} hidden={!props.showDialog}>
|
||||
<DialogContainer
|
||||
className="xs:w-[85%] w-[92%] sm:w-[75%]"
|
||||
className="xs:w-[90%] no-scrollbar max-h-full w-[92%] max-w-[600px] overflow-auto sm:w-[88%] md:w-[80%]"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ import { getFontSize, isJetBrains } from "../util";
|
|||
export const VSC_INPUT_BACKGROUND_VAR = "--vscode-input-background";
|
||||
export const VSC_BACKGROUND_VAR = "--vscode-sideBar-background";
|
||||
export const VSC_FOREGROUND_VAR = "--vscode-editor-foreground";
|
||||
export const VSC_FOREGROUND_MUTED_VAR = "--vscode-foreground-muted";
|
||||
export const VSC_DESCRIPTION_FOREGROUND = "--vscode-descriptionForeground";
|
||||
export const VSC_INPUT_PLACEHOLDER_FOREGROUND =
|
||||
"--vscode-input-placeholderForeground";
|
||||
export const VSC_BUTTON_BACKGROUND_VAR = "--vscode-button-background";
|
||||
export const VSC_BUTTON_FOREGROUND_VAR = "--vscode-button-foreground";
|
||||
export const VSC_EDITOR_BACKGROUND_VAR = "--vscode-editor-background";
|
||||
|
|
@ -27,6 +31,9 @@ export const VSC_THEME_COLOR_VARS = [
|
|||
VSC_INPUT_BACKGROUND_VAR,
|
||||
VSC_BACKGROUND_VAR,
|
||||
VSC_FOREGROUND_VAR,
|
||||
VSC_FOREGROUND_MUTED_VAR,
|
||||
VSC_DESCRIPTION_FOREGROUND,
|
||||
VSC_INPUT_PLACEHOLDER_FOREGROUND,
|
||||
VSC_BUTTON_BACKGROUND_VAR,
|
||||
VSC_BUTTON_FOREGROUND_VAR,
|
||||
VSC_EDITOR_BACKGROUND_VAR,
|
||||
|
|
@ -51,6 +58,9 @@ export const vscInputBackground = `var(${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45
|
|||
export const vscQuickInputBackground = `var(${VSC_QUICK_INPUT_BACKGROUND_VAR}, ${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`;
|
||||
export const vscBackground = `var(${VSC_BACKGROUND_VAR}, rgb(30 30 30))`;
|
||||
export const vscForeground = `var(${VSC_FOREGROUND_VAR}, #fff)`;
|
||||
export const vscForegroundMuted = `var(${VSC_FOREGROUND_MUTED_VAR}, #999)`;
|
||||
export const vscDescriptionForeground = `var(${VSC_DESCRIPTION_FOREGROUND}, #999)`;
|
||||
export const vscInputPlaceholderForeground = `var(${VSC_INPUT_PLACEHOLDER_FOREGROUND}, #999)`;
|
||||
export const vscButtonBackground = `var(${VSC_BUTTON_BACKGROUND_VAR}, #1bbe84)`;
|
||||
export const vscButtonForeground = `var(${VSC_BUTTON_FOREGROUND_VAR}, #ffffff)`;
|
||||
export const vscEditorBackground = `var(${VSC_EDITOR_BACKGROUND_VAR}, ${VSC_BACKGROUND_VAR}, rgb(30 30 30))`;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ function ChatIndexingPeek({ state }: ChatIndexingPeekProps) {
|
|||
<p className="m-0 p-0 text-stone-500 group-hover:underline">
|
||||
{state.displayName}
|
||||
</p>
|
||||
{/* <p className="no-underline lines lines-1 m-0 max-w-20 p-0 text-xs text-stone-500">
|
||||
{state.titles.join(", ")}
|
||||
</p> */}
|
||||
</div>
|
||||
<div className="my-2 h-1.5 flex-1 rounded-md border border-solid border-gray-400">
|
||||
<div
|
||||
|
|
@ -104,7 +101,7 @@ function ChatIndexingPeeks() {
|
|||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
{mergedIndexingStates.map((state) => {
|
||||
return <ChatIndexingPeek state={state} />;
|
||||
return <ChatIndexingPeek key={state.type} state={state} />;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
83
gui/src/components/indexing/DocsIndexingPeeks.tsx
Normal file
83
gui/src/components/indexing/DocsIndexingPeeks.tsx
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
import { IndexingStatus } from "core";
|
||||
import { useMemo } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { ArrowPathIcon } from "@heroicons/react/24/outline";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../redux/slices/uiStateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
|
||||
export interface DocsIndexingPeekProps {
|
||||
status: IndexingStatus;
|
||||
}
|
||||
|
||||
function DocsIndexingPeek({ status }: DocsIndexingPeekProps) {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const progressPercentage = useMemo(() => {
|
||||
return Math.min(100, Math.max(0, status.progress * 100));
|
||||
}, [status.progress]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex cursor-pointer flex-row items-center gap-2 rounded-md px-1 text-stone-500 hover:bg-gray-700/10"
|
||||
onClick={() => {
|
||||
navigate("/more");
|
||||
dispatch(setShowDialog(false));
|
||||
dispatch(setDialogMessage(undefined));
|
||||
}}
|
||||
>
|
||||
<p className="m-0 p-0 text-stone-500 group-hover:underline">
|
||||
{status.title}
|
||||
</p>
|
||||
<div className="my-2 h-1.5 flex-1 rounded-md border border-solid border-gray-400">
|
||||
<div
|
||||
className={`h-full rounded-lg bg-stone-500 transition-all duration-200 ease-in-out`}
|
||||
style={{
|
||||
width: `${progressPercentage}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="xs:flex hidden flex-row items-center gap-1 text-stone-500">
|
||||
<span className="text-xs no-underline">
|
||||
{progressPercentage.toFixed(0)}%
|
||||
</span>
|
||||
{/* <ArrowPathIcon
|
||||
className={`animate-spin-slow inline-block h-4 w-4 text-stone-500`}
|
||||
></ArrowPathIcon> */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface DocsIndexingPeeksProps {
|
||||
statuses: IndexingStatus[];
|
||||
}
|
||||
|
||||
function DocsIndexingPeekList({ statuses }: DocsIndexingPeeksProps) {
|
||||
const config = useSelector((store: RootState) => store.state.config);
|
||||
const configDocs = config.docs ?? [];
|
||||
// const docs
|
||||
return (
|
||||
<div className="border-vsc-input-border mt-2 flex flex-col border-0 border-t border-solid pt-2">
|
||||
<p className="mx-0 my-1.5 p-0 px-1 font-semibold text-stone-500">
|
||||
Currently Indexing:
|
||||
</p>
|
||||
<div className="max-h-[100px] overflow-y-auto pr-2">
|
||||
{statuses.length ? (
|
||||
statuses.map((status) => {
|
||||
return <DocsIndexingPeek key={status.id} status={status} />;
|
||||
})
|
||||
) : (
|
||||
<p className="m-0 pl-1 font-semibold text-stone-500">None</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DocsIndexingPeekList;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { IndexingStatus } from "core";
|
||||
import { IndexingStatus, SiteIndexingConfig } from "core";
|
||||
import { PropsWithChildren, useContext, useMemo } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import {
|
||||
|
|
@ -12,9 +12,10 @@ import {
|
|||
XMarkIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { updateIndexingStatus } from "../../redux/slices/stateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
|
||||
interface IndexingStatusViewerProps {
|
||||
status: IndexingStatus;
|
||||
docConfig: SiteIndexingConfig;
|
||||
}
|
||||
|
||||
const STATUS_TO_ICON: Record<IndexingStatus["status"], any> = {
|
||||
|
|
@ -27,33 +28,43 @@ const STATUS_TO_ICON: Record<IndexingStatus["status"], any> = {
|
|||
failed: XMarkIcon, // Since we show an erorr message below
|
||||
};
|
||||
|
||||
function IndexingStatusViewer({ status }: IndexingStatusViewerProps) {
|
||||
function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const posthog = usePostHog();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
// const status = undefined;
|
||||
const status = useSelector(
|
||||
(store: RootState) => store.state.indexing.statuses[docConfig.startUrl],
|
||||
);
|
||||
|
||||
const reIndex = () =>
|
||||
ideMessenger.post("indexing/reindex", {
|
||||
type: status.type,
|
||||
id: status.id,
|
||||
type: "docs",
|
||||
id: docConfig.startUrl,
|
||||
});
|
||||
|
||||
const abort = () => {
|
||||
ideMessenger.post("indexing/abort", {
|
||||
type: status.type,
|
||||
id: status.id,
|
||||
type: "docs",
|
||||
id: docConfig.startUrl,
|
||||
});
|
||||
// Optimistic abort status
|
||||
dispatch(
|
||||
updateIndexingStatus({ ...status, status: "aborted", progress: 0 }),
|
||||
);
|
||||
if (status) {
|
||||
dispatch(
|
||||
updateIndexingStatus({ ...status, status: "aborted", progress: 0 }),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const progressPercentage = useMemo(() => {
|
||||
if (!status) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(100, Math.max(0, status.progress * 100));
|
||||
}, [status.progress]);
|
||||
}, [status?.progress]);
|
||||
|
||||
const Icon = STATUS_TO_ICON[status.status];
|
||||
const Icon = STATUS_TO_ICON[status?.status];
|
||||
|
||||
return (
|
||||
<div className="mt-2 flex w-full flex-col">
|
||||
|
|
@ -62,24 +73,26 @@ function IndexingStatusViewer({ status }: IndexingStatusViewerProps) {
|
|||
className={`flex flex-row items-center justify-between gap-2 text-sm`}
|
||||
>
|
||||
<div
|
||||
className={`flex flex-row items-center gap-2 ${status.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
className={`flex flex-row items-center gap-2 ${status?.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
onClick={() => {
|
||||
if (status.url) {
|
||||
if (status?.url) {
|
||||
ideMessenger.post("openUrl", status.url);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{status.icon ? (
|
||||
<img src={status.icon} alt="doc icon" className="h-4 w-4" />
|
||||
{docConfig.faviconUrl ? (
|
||||
<img
|
||||
src={docConfig.faviconUrl}
|
||||
alt="doc icon"
|
||||
className="h-4 w-4"
|
||||
/>
|
||||
) : null}
|
||||
<p className="lines lines-1 m-0 p-0 text-left">
|
||||
{status.title ?? status.id}
|
||||
{docConfig.title ?? docConfig.startUrl}
|
||||
</p>
|
||||
{!!status.url && (
|
||||
<ArrowTopRightOnSquareIcon className="mb-0.5 h-3 w-3 text-stone-500" />
|
||||
)}
|
||||
<ArrowTopRightOnSquareIcon className="mb-0.5 h-3 w-3 text-stone-500" />
|
||||
</div>
|
||||
{status.status === "pending" ? (
|
||||
{status?.status === "pending" ? (
|
||||
<div className="text-xs text-stone-500">Pending...</div>
|
||||
) : (
|
||||
<div className="flex flex-row items-center gap-1 text-stone-500">
|
||||
|
|
@ -87,7 +100,7 @@ function IndexingStatusViewer({ status }: IndexingStatusViewerProps) {
|
|||
{Icon ? (
|
||||
<Icon
|
||||
className={`inline-block h-4 w-4 text-stone-500 ${
|
||||
status.status === "indexing" ? "animate-spin-slow" : ""
|
||||
status?.status === "indexing" ? "animate-spin-slow" : ""
|
||||
}`}
|
||||
></Icon>
|
||||
) : null}
|
||||
|
|
@ -98,7 +111,7 @@ function IndexingStatusViewer({ status }: IndexingStatusViewerProps) {
|
|||
<div className="my-2 h-1.5 w-full rounded-md border border-solid border-gray-400">
|
||||
<div
|
||||
className={`h-full rounded-lg transition-all duration-200 ease-in-out ${
|
||||
status.status === "failed" ? "bg-red-600" : "bg-stone-500"
|
||||
status?.status === "failed" ? "bg-red-600" : "bg-stone-500"
|
||||
}`}
|
||||
style={{
|
||||
width: `${progressPercentage}%`,
|
||||
|
|
@ -118,7 +131,7 @@ function IndexingStatusViewer({ status }: IndexingStatusViewerProps) {
|
|||
paused: () => {},
|
||||
deleted: () => {},
|
||||
pending: () => {},
|
||||
}[status.status]
|
||||
}[status?.status]
|
||||
}
|
||||
>
|
||||
{
|
||||
|
|
@ -130,18 +143,16 @@ function IndexingStatusViewer({ status }: IndexingStatusViewerProps) {
|
|||
paused: "",
|
||||
deleted: "",
|
||||
pending: "",
|
||||
}[status.status]
|
||||
}[status?.status]
|
||||
}
|
||||
</span>
|
||||
|
||||
{/* {status.status === "indexing" && ( */}
|
||||
<span className="lines lines-1 text-right text-xs text-stone-500">
|
||||
{status.description}
|
||||
{status?.description}
|
||||
</span>
|
||||
{/* )} */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default IndexingStatusViewer;
|
||||
export default DocsIndexingStatus;
|
||||
57
gui/src/components/indexing/DocsIndexingStatuses.tsx
Normal file
57
gui/src/components/indexing/DocsIndexingStatuses.tsx
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { useMemo } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { RootState } from "../../redux/store";
|
||||
import IndexingStatusViewer from "./DocsIndexingStatus";
|
||||
import { SecondaryButton } from "..";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../redux/slices/uiStateSlice";
|
||||
import AddDocsDialog from "../dialogs/AddDocsDialog";
|
||||
import DocsIndexingStatus from "./DocsIndexingStatus";
|
||||
|
||||
function DocsIndexingStatuses() {
|
||||
const dispatch = useDispatch();
|
||||
const config = useSelector((store: RootState) => store.state.config);
|
||||
const configDocs = config.docs ?? [];
|
||||
|
||||
// const indexingStatuses = useSelector(
|
||||
// (store: RootState) => store.state.indexing.statuses,
|
||||
// );
|
||||
// const docsStatuses = useMemo(() => {
|
||||
// const docs = Object.values(indexingStatuses).filter(
|
||||
// (status) => status.type === "docs" && status.status !== "deleted",
|
||||
// );
|
||||
// return docs;
|
||||
// }, [indexingStatuses]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<h3 className="mb-1 mt-0 text-xl">@docs indexes</h3>
|
||||
{configDocs.length ? (
|
||||
<SecondaryButton
|
||||
className="border-vsc-foreground text-vsc-foreground enabled:hover:bg-vsc-background m-2 rounded border bg-inherit px-3 py-2 enabled:hover:cursor-pointer enabled:hover:opacity-90 disabled:text-gray-500"
|
||||
type="submit"
|
||||
onClick={() => {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(setDialogMessage(<AddDocsDialog />));
|
||||
}}
|
||||
>
|
||||
Add
|
||||
</SecondaryButton>
|
||||
) : null}
|
||||
</div>
|
||||
<span className="text-xs text-stone-500">
|
||||
Manage your documentation sources
|
||||
</span>
|
||||
<div className="flex max-h-[170px] flex-col gap-1 overflow-x-hidden overflow-y-scroll pr-2">
|
||||
{configDocs.map((doc) => {
|
||||
return <DocsIndexingStatus key={doc.startUrl} docConfig={doc} />;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DocsIndexingStatuses;
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
import { useMemo } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { RootState } from "../../redux/store";
|
||||
import IndexingStatusViewer from "./IndexingStatus";
|
||||
import { Button, SecondaryButton } from "..";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../redux/slices/uiStateSlice";
|
||||
import AddDocsDialog from "../dialogs/AddDocsDialog";
|
||||
|
||||
function IndexingStatuses() {
|
||||
const indexingStatuses = useSelector(
|
||||
(store: RootState) => store.state.indexing.statuses,
|
||||
);
|
||||
const docsStatuses = useMemo(() => {
|
||||
const docs = Object.values(indexingStatuses).filter(
|
||||
(status) => status.type === "docs" && status.status !== "deleted",
|
||||
);
|
||||
return docs;
|
||||
}, [indexingStatuses]);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<h3 className="mb-1 mt-0 text-xl">@docs indexes</h3>
|
||||
{/* <div className="border-1 rounded-full border">
|
||||
<ChevronUpIcon className="h-8 w-8" />
|
||||
</div> */}
|
||||
{/* TODO add some way to hide, scroll, etc. */}
|
||||
</div>
|
||||
<span className="text-xs text-stone-500">
|
||||
Manage your documentation sources
|
||||
</span>
|
||||
{/* <div className="flex max-h-[170px] flex-col gap-1 overflow-x-hidden overflow-y-scroll pr-2"> */}
|
||||
{docsStatuses.length ? (
|
||||
docsStatuses.map((status) => {
|
||||
return <IndexingStatusViewer key={status.id} status={status} />;
|
||||
})
|
||||
) : (
|
||||
<SecondaryButton
|
||||
onClick={() => {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(setDialogMessage(<AddDocsDialog />));
|
||||
}}
|
||||
>
|
||||
Add Docs
|
||||
</SecondaryButton>
|
||||
)}
|
||||
</div>
|
||||
// </div>
|
||||
);
|
||||
}
|
||||
|
||||
export default IndexingStatuses;
|
||||
|
|
@ -382,7 +382,6 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
) : (
|
||||
<>
|
||||
{subMenuTitle && <ItemDiv className="mb-2">{subMenuTitle}</ItemDiv>}
|
||||
{/* <CustomScrollbarDiv className="overflow-y-scroll max-h-96"> */}
|
||||
{allItems.length ? (
|
||||
allItems.map((item, index) => (
|
||||
<ItemDiv
|
||||
|
|
@ -402,7 +401,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
height="20px"
|
||||
width="20px"
|
||||
filename={item.description}
|
||||
></FileIcon>
|
||||
/>
|
||||
)}
|
||||
{!showFileIconForItem(item) && (
|
||||
<>
|
||||
|
|
@ -414,7 +413,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
</div>
|
||||
<span
|
||||
style={{
|
||||
color: vscListActiveForeground,
|
||||
color: lightGray,
|
||||
float: "right",
|
||||
textAlign: "right",
|
||||
opacity: index !== selectedIndex ? 0 : 1,
|
||||
|
|
|
|||
|
|
@ -40,16 +40,22 @@ import { IdeMessengerContext } from "../../context/IdeMessenger";
|
|||
import { useSubmenuContextProviders } from "../../context/SubmenuContextProviders";
|
||||
import useHistory from "../../hooks/useHistory";
|
||||
import { useInputHistory } from "../../hooks/useInputHistory";
|
||||
import useIsOSREnabled from "../../hooks/useIsOSREnabled";
|
||||
import useUpdatingRef from "../../hooks/useUpdatingRef";
|
||||
import { useWebviewListener } from "../../hooks/useWebviewListener";
|
||||
import { selectUseActiveFile } from "../../redux/selectors";
|
||||
import { defaultModelSelector } from "../../redux/selectors/modelSelectors";
|
||||
import {
|
||||
addCodeToEdit,
|
||||
clearCodeToEdit,
|
||||
} from "../../redux/slices/editModeState";
|
||||
import { RootState } from "../../redux/store";
|
||||
import {
|
||||
getFontSize,
|
||||
isJetBrains,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../util";
|
||||
import { AddCodeToEdit } from "./AddCodeToEditExtension";
|
||||
import { CodeBlockExtension } from "./CodeBlockExtension";
|
||||
import { SlashCommand } from "./CommandsExtension";
|
||||
import InputToolbar, { ToolbarOptions } from "./InputToolbar";
|
||||
|
|
@ -64,10 +70,6 @@ import {
|
|||
handleVSCMetaKeyIssues,
|
||||
} from "./handleMetaKeyIssues";
|
||||
import { ComboBoxItem } from "./types";
|
||||
import useIsOSREnabled from "../../hooks/useIsOSREnabled";
|
||||
import { setShouldAddFileForEditing } from "../../redux/slices/uiStateSlice";
|
||||
import { AddCodeToEdit } from "./AddCodeToEditExtension";
|
||||
import { addCodeToEdit } from "../../redux/slices/editModeState";
|
||||
|
||||
const InputBoxDiv = styled.div<{ border?: string }>`
|
||||
resize: none;
|
||||
|
|
@ -313,16 +315,6 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const { prevRef, nextRef, addRef } = useInputHistory(props.historyKey);
|
||||
|
||||
function getPlaceholder() {
|
||||
if (!hasDefaultModel) {
|
||||
return "Configure a Chat model to get started";
|
||||
}
|
||||
|
||||
return historyLengthRef.current === 0
|
||||
? "Ask anything, '/' for slash commands, '@' to add context"
|
||||
: "Ask a follow-up";
|
||||
}
|
||||
|
||||
const editor: Editor = useEditor({
|
||||
extensions: [
|
||||
Document,
|
||||
|
|
@ -366,7 +358,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
placeholder:
|
||||
props.placeholder ??
|
||||
(historyLengthRef.current === 0
|
||||
? "Ask anything, '/' for slash commands, '@' to add context"
|
||||
? "Ask anything, '@' to add context"
|
||||
: "Ask a follow-up"),
|
||||
}),
|
||||
Paragraph.extend({
|
||||
|
|
@ -459,25 +451,23 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
},
|
||||
}),
|
||||
Text,
|
||||
props.availableContextProviders.length
|
||||
? Mention.configure({
|
||||
HTMLAttributes: {
|
||||
class: "mention",
|
||||
},
|
||||
suggestion: getContextProviderDropdownOptions(
|
||||
availableContextProvidersRef,
|
||||
getSubmenuContextItemsRef,
|
||||
enterSubmenu,
|
||||
onClose,
|
||||
onOpen,
|
||||
inSubmenuRef,
|
||||
ideMessenger,
|
||||
),
|
||||
renderHTML: (props) => {
|
||||
return `@${props.node.attrs.label || props.node.attrs.id}`;
|
||||
},
|
||||
})
|
||||
: undefined,
|
||||
Mention.configure({
|
||||
HTMLAttributes: {
|
||||
class: "mention",
|
||||
},
|
||||
suggestion: getContextProviderDropdownOptions(
|
||||
availableContextProvidersRef,
|
||||
getSubmenuContextItemsRef,
|
||||
enterSubmenu,
|
||||
onClose,
|
||||
onOpen,
|
||||
inSubmenuRef,
|
||||
ideMessenger,
|
||||
),
|
||||
renderHTML: (props) => {
|
||||
return `@${props.node.attrs.label || props.node.attrs.id}`;
|
||||
},
|
||||
}),
|
||||
isInEditMode
|
||||
? AddCodeToEdit.configure({
|
||||
HTMLAttributes: {
|
||||
|
|
@ -657,6 +647,8 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
useWebviewListener(
|
||||
"focusContinueInput",
|
||||
async (data) => {
|
||||
dispatch(clearCodeToEdit());
|
||||
|
||||
if (!props.isMainInput) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -822,13 +814,6 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const [activeKey, setActiveKey] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (shouldAddFileForEditing && props.isMainInput) {
|
||||
insertCharacterWithWhitespace("#");
|
||||
dispatch(setShouldAddFileForEditing(false));
|
||||
}
|
||||
}, [shouldAddFileForEditing]);
|
||||
|
||||
const insertCharacterWithWhitespace = useCallback(
|
||||
(char: string) => {
|
||||
const text = editor.getText();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export default function GeneratingCodeLoader({
|
|||
|
||||
return (
|
||||
<span className="inline-flex items-center gap-2 text-gray-400">
|
||||
{showLineCount ? linesGeneratedText : "Generating..."}
|
||||
{showLineCount ? linesGeneratedText : "Generating"}
|
||||
<Spinner />
|
||||
</span>
|
||||
);
|
||||
|
|
|
|||
27
gui/src/components/svg/DiscordIcon.tsx
Normal file
27
gui/src/components/svg/DiscordIcon.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
interface DiscordIconProps extends React.SVGProps<SVGSVGElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export function DiscordIcon({
|
||||
size = 24,
|
||||
className,
|
||||
...props
|
||||
}: DiscordIconProps) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
className={className}
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M20.317 4.369a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.038 13.875 13.875 0 00-.6 1.235 18.337 18.337 0 00-5.487 0 13.872 13.872 0 00-.601-1.235.076.076 0 00-.079-.038A19.736 19.736 0 003.677 4.369a.069.069 0 00-.032.027C.533 9.104-.32 13.726.099 18.306a.082.082 0 00.031.054 19.911 19.911 0 005.993 3.04.078.078 0 00.084-.027 14.345 14.345 0 001.273-2.084.076.076 0 00-.041-.105 13.134 13.134 0 01-1.872-.891.077.077 0 01-.008-.128c.126-.094.252-.192.373-.291a.074.074 0 01.077-.01c3.927 1.794 8.18 1.794 12.061 0a.074.074 0 01.078.009c.121.099.247.198.374.292a.077.077 0 01-.006.127 12.48 12.48 0 01-1.873.891.076.076 0 00-.04.106 14.504 14.504 0 001.273 2.083.077.077 0 00.084.028 19.888 19.888 0 005.993-3.04.077.077 0 00.031-.054c.5-5.177-.838-9.772-3.576-13.91a.061.061 0 00-.032-.028zM9.237 15.335c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.418 2.156-2.418 1.21 0 2.184 1.085 2.156 2.418.001 1.334-.946 2.419-2.156 2.419zm5.526 0c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.418 2.156-2.418 1.21 0 2.184 1.085 2.156 2.418 0 1.334-.946 2.419-2.156 2.419z"
|
||||
fill="currentColor"
|
||||
strokeWidth="0"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
27
gui/src/components/svg/GithubIcon.tsx
Normal file
27
gui/src/components/svg/GithubIcon.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
interface GithubIconProps extends React.SVGProps<SVGSVGElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export function GithubIcon({
|
||||
size = 24,
|
||||
className,
|
||||
...props
|
||||
}: GithubIconProps) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
className={className}
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.341-3.369-1.341-.454-1.155-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836c.85.004 1.705.115 2.504.337 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.167 22 16.418 22 12c0-5.523-4.477-10-10-10z"
|
||||
fill="currentColor"
|
||||
strokeWidth="0"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||
setDialogMessage(
|
||||
<ConfirmationDialog
|
||||
text={
|
||||
"Welcome to Continue for teams! Using the toggle in the bottom right, you can switch between your local profile (defined by config.json) and team profiles (defined in the Continue for teams web app). Each profile defines a set of models, slash commands, context providers, and other settings to customize Continue."
|
||||
"Welcome to Continue for teams! Using account icon in the top right, you can switch between your local profile (defined by config.json) and team profiles (defined in the Continue for teams web app). Each profile defines a set of models, slash commands, context providers, and other settings to customize Continue."
|
||||
}
|
||||
hideCancelButton={true}
|
||||
confirmText="Ok"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ const MINISEARCH_OPTIONS = {
|
|||
|
||||
const MAX_LENGTH = 70;
|
||||
|
||||
export interface ContextSubmenuItemWithProvider extends ContextSubmenuItem {
|
||||
providerTitle: string;
|
||||
}
|
||||
|
||||
interface SubtextContextProvidersContextType {
|
||||
getSubmenuContextItems: (
|
||||
providerTitle: string | undefined,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { Dispatch } from "@reduxjs/toolkit";
|
||||
import { JSONContent } from "@tiptap/react";
|
||||
import {
|
||||
ChatHistory,
|
||||
ChatHistoryItem,
|
||||
ChatMessage,
|
||||
ContextItemWithId,
|
||||
|
|
@ -258,11 +257,12 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
|
|||
ideMessenger,
|
||||
dispatch,
|
||||
);
|
||||
|
||||
if (promptPreamble) {
|
||||
typeof content === "string"
|
||||
? (content += promptPreamble)
|
||||
: (content.at(-1).text += promptPreamble);
|
||||
if (typeof content === "string") {
|
||||
content = promptPreamble + content;
|
||||
} else {
|
||||
content[0].text = promptPreamble + content[0].text;
|
||||
}
|
||||
}
|
||||
|
||||
const message: ChatMessage = {
|
||||
|
|
@ -276,7 +276,10 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
|
|||
editorState,
|
||||
};
|
||||
|
||||
let newHistory: ChatHistory = [...history.slice(0, index), historyItem];
|
||||
let newHistory: ChatHistoryItem[] = [
|
||||
...history.slice(0, index),
|
||||
historyItem,
|
||||
];
|
||||
const historyIndex = index || newHistory.length - 1;
|
||||
dispatch(
|
||||
setMessageAtIndex({
|
||||
|
|
@ -324,10 +327,6 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
|
|||
} catch (e: any) {
|
||||
dispatch(clearLastEmptyResponse());
|
||||
console.debug("Error streaming response: ", e);
|
||||
ideMessenger.post("showToast", [
|
||||
"error",
|
||||
`Error streaming response: ${e.message}`,
|
||||
]);
|
||||
} finally {
|
||||
dispatch(setInactive());
|
||||
triggerSave(!save);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { Dispatch } from "@reduxjs/toolkit";
|
||||
import { PersistedSessionInfo, SessionInfo } from "core";
|
||||
import { Session, SessionMetadata } from "core";
|
||||
|
||||
import { stripImages } from "core/llm/images";
|
||||
import { useCallback, useContext } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { useLastSessionContext } from "../context/LastSessionContext";
|
||||
import { newSession } from "../redux/slices/stateSlice";
|
||||
import { newSession, updateSessionTitle } from "../redux/slices/stateSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
|
||||
|
||||
|
|
@ -20,7 +20,13 @@ function truncateText(text: string, maxLength: number) {
|
|||
}
|
||||
|
||||
function useHistory(dispatch: Dispatch) {
|
||||
const state = useSelector((state: RootState) => state.state);
|
||||
const sessionId = useSelector((store: RootState) => store.state.sessionId);
|
||||
const config = useSelector((store: RootState) => store.state.config);
|
||||
const history = useSelector((store: RootState) => store.state.history);
|
||||
const checkpoints = useSelector(
|
||||
(store: RootState) => store.state.checkpoints,
|
||||
);
|
||||
const title = useSelector((store: RootState) => store.state.title);
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { lastSessionId, setLastSessionId } = useLastSessionContext();
|
||||
|
||||
|
|
@ -32,7 +38,7 @@ function useHistory(dispatch: Dispatch) {
|
|||
async function getHistory(
|
||||
offset?: number,
|
||||
limit?: number,
|
||||
): Promise<SessionInfo[]> {
|
||||
): Promise<SessionMetadata[]> {
|
||||
const result = await ideMessenger.request("history/list", {
|
||||
offset,
|
||||
limit,
|
||||
|
|
@ -49,24 +55,18 @@ function useHistory(dispatch: Dispatch) {
|
|||
}
|
||||
|
||||
async function saveSession(openNewSession: boolean = true) {
|
||||
if (state.history.length === 0) return;
|
||||
if (history.length === 0) return;
|
||||
|
||||
const stateCopy = { ...state };
|
||||
if (openNewSession) {
|
||||
dispatch(newSession());
|
||||
updateLastSessionId(stateCopy.sessionId);
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
|
||||
if (state.config?.ui?.getChatTitles && stateCopy.title === "New Session") {
|
||||
let currentTitle = title;
|
||||
if (config?.ui?.getChatTitles && currentTitle === "New Session") {
|
||||
try {
|
||||
// Check if we have first assistant response
|
||||
let assistantResponse = stateCopy.history
|
||||
let assistantResponse = history
|
||||
?.filter((h) => h.message.role === "assistant")[0]
|
||||
?.message?.content?.toString();
|
||||
|
||||
if (assistantResponse) {
|
||||
stateCopy.title = await getChatTitle(assistantResponse);
|
||||
currentTitle = await getChatTitle(assistantResponse);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error("Unable to get chat title");
|
||||
|
|
@ -74,31 +74,38 @@ function useHistory(dispatch: Dispatch) {
|
|||
}
|
||||
|
||||
// Fallback if we get an error above or if the user has not set getChatTitles
|
||||
let title =
|
||||
stateCopy.title === "New Session"
|
||||
let newTitle =
|
||||
currentTitle === "New Session"
|
||||
? truncateText(
|
||||
stripImages(stateCopy.history[0].message.content)
|
||||
stripImages(history[0].message.content)
|
||||
.split("\n")
|
||||
.filter((l) => l.trim() !== "")
|
||||
.slice(-1)[0] || "",
|
||||
MAX_TITLE_LENGTH,
|
||||
)
|
||||
: stateCopy.title?.length > 0
|
||||
? stateCopy.title
|
||||
: (await getSession(stateCopy.sessionId)).title; // to ensure titles are synced with updates from history page.
|
||||
: currentTitle?.length > 0
|
||||
? currentTitle
|
||||
: (await getSession(sessionId)).title; // to ensure titles are synced with updates from history page.
|
||||
|
||||
const sessionInfo: PersistedSessionInfo = {
|
||||
history: stateCopy.history,
|
||||
title: title,
|
||||
sessionId: stateCopy.sessionId,
|
||||
const session: Session = {
|
||||
sessionId,
|
||||
title: newTitle,
|
||||
workspaceDirectory: window.workspacePaths?.[0] || "",
|
||||
checkpoints: stateCopy.checkpoints,
|
||||
history,
|
||||
checkpoints,
|
||||
};
|
||||
|
||||
return await ideMessenger.request("history/save", sessionInfo);
|
||||
await ideMessenger.request("history/save", session);
|
||||
|
||||
if (openNewSession) {
|
||||
dispatch(newSession());
|
||||
updateLastSessionId(sessionId);
|
||||
} else {
|
||||
dispatch(updateSessionTitle(newTitle));
|
||||
}
|
||||
}
|
||||
|
||||
async function getSession(id: string): Promise<PersistedSessionInfo> {
|
||||
async function getSession(id: string): Promise<Session> {
|
||||
const result = await ideMessenger.request("history/load", { id });
|
||||
if (result.status === "error") {
|
||||
throw new Error(result.error);
|
||||
|
|
@ -106,16 +113,16 @@ function useHistory(dispatch: Dispatch) {
|
|||
return result.content;
|
||||
}
|
||||
|
||||
async function updateSession(sessionInfo: PersistedSessionInfo) {
|
||||
return await ideMessenger.request("history/save", sessionInfo);
|
||||
async function updateSession(session: Session) {
|
||||
return await ideMessenger.request("history/save", session);
|
||||
}
|
||||
|
||||
async function deleteSession(id: string) {
|
||||
return await ideMessenger.request("history/delete", { id });
|
||||
}
|
||||
|
||||
async function loadSession(id: string): Promise<PersistedSessionInfo> {
|
||||
updateLastSessionId(state.sessionId);
|
||||
async function loadSession(id: string): Promise<Session> {
|
||||
updateLastSessionId(sessionId);
|
||||
const result = await ideMessenger.request("history/load", { id });
|
||||
if (result.status === "error") {
|
||||
throw new Error(result.error);
|
||||
|
|
@ -126,7 +133,7 @@ function useHistory(dispatch: Dispatch) {
|
|||
return sessionContent;
|
||||
}
|
||||
|
||||
async function loadLastSession(): Promise<PersistedSessionInfo | undefined> {
|
||||
async function loadLastSession(): Promise<Session | undefined> {
|
||||
const lastSessionId = getLocalStorage("lastSessionId");
|
||||
if (lastSessionId) {
|
||||
return await loadSession(lastSessionId);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
setInactive,
|
||||
setSelectedProfileId,
|
||||
setTTSActive,
|
||||
updateDocsSuggestions,
|
||||
updateIndexingStatus,
|
||||
} from "../redux/slices/stateSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
|
|
@ -57,9 +58,12 @@ function useSetup(dispatch: Dispatch) {
|
|||
loadConfig(true);
|
||||
const interval = setInterval(() => {
|
||||
if (hasLoadedConfig.current) {
|
||||
// Docs init on config load
|
||||
ideMessenger.post("docs/getSuggestedDocs", undefined);
|
||||
ideMessenger.post("docs/initStatuses", undefined);
|
||||
|
||||
// This triggers sending pending status to the GUI for relevant docs indexes
|
||||
clearInterval(interval);
|
||||
ideMessenger.post("indexing/initStatuses", undefined);
|
||||
return;
|
||||
}
|
||||
loadConfig(true);
|
||||
|
|
@ -123,6 +127,10 @@ function useSetup(dispatch: Dispatch) {
|
|||
}
|
||||
}, []);
|
||||
|
||||
useWebviewListener("docs/suggestions", async (data) => {
|
||||
dispatch(updateDocsSuggestions(data));
|
||||
});
|
||||
|
||||
const { streamResponse } = useChatHandler(dispatch, ideMessenger);
|
||||
|
||||
// IDE event listeners
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
import { useContext } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { removeCodeToEdit } from "../../redux/slices/editModeState";
|
||||
import { RootState } from "../../redux/store";
|
||||
import CodeToEditListItem from "./CodeToEditListItem";
|
||||
|
||||
import { CodeToEdit, RangeInFileWithContents } from "core";
|
||||
import AddFileButton from "./AddFileButton";
|
||||
|
||||
export default function WorkingSet() {
|
||||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const codeToEdit = useSelector(
|
||||
(state: RootState) => state.editModeState.codeToEdit,
|
||||
);
|
||||
|
||||
const title =
|
||||
codeToEdit.length === 0
|
||||
? "Code to edit"
|
||||
: codeToEdit.length === 1
|
||||
? "Code to edit (1 item)"
|
||||
: `Code to edit (${codeToEdit.length} items)`;
|
||||
|
||||
function onDelete(rif: RangeInFileWithContents) {
|
||||
dispatch(removeCodeToEdit(rif));
|
||||
}
|
||||
|
||||
function onClickFilename(code: CodeToEdit) {
|
||||
if ("range" in code) {
|
||||
ideMessenger.ide.showLines(
|
||||
code.filepath,
|
||||
code.range.start.line,
|
||||
code.range.end.line,
|
||||
);
|
||||
} else {
|
||||
ideMessenger.ide.openFile(code.filepath);
|
||||
}
|
||||
}
|
||||
|
||||
const codeToEditItems = [...codeToEdit]
|
||||
.reverse()
|
||||
.map((code, i) => (
|
||||
<CodeToEditListItem
|
||||
key={code.filepath + i}
|
||||
code={code}
|
||||
onDelete={onDelete}
|
||||
onClickFilename={onClickFilename}
|
||||
/>
|
||||
));
|
||||
|
||||
return (
|
||||
<div className="bg-vsc-editor-background border-vsc-input-border mx-1 flex flex-col rounded-t-lg border border-b-0 border-solid p-1">
|
||||
<div className="text-lightgray flex items-center justify-between gap-1.5 py-1.5 pl-3 pr-2 text-xs">
|
||||
<span>{title}</span>
|
||||
<AddFileButton />
|
||||
</div>
|
||||
|
||||
{codeToEdit.length > 0 && (
|
||||
<ul className="no-scrollbar mb-1.5 mt-1 max-h-[50vh] list-outside list-none overflow-y-auto pl-0">
|
||||
{codeToEditItems}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ import { setOnboardingCard } from "../../redux/slices/uiStateSlice";
|
|||
import useHistory from "../../hooks/useHistory";
|
||||
import MoreHelpRow from "./MoreHelpRow";
|
||||
import IndexingProgress from "./IndexingProgress";
|
||||
import IndexingStatuses from "../../components/indexing/IndexingStatuses";
|
||||
import DocsIndexingStatuses from "../../components/indexing/DocsIndexingStatuses";
|
||||
|
||||
function MorePage() {
|
||||
useNavigationListener();
|
||||
|
|
@ -52,7 +52,7 @@ function MorePage() {
|
|||
<IndexingProgress />
|
||||
</div>
|
||||
<div className="flex flex-col py-5">
|
||||
<IndexingStatuses />
|
||||
<DocsIndexingStatuses />
|
||||
</div>
|
||||
|
||||
<div className="py-5">
|
||||
|
|
|
|||
|
|
@ -1,27 +1,29 @@
|
|||
import { useContext, useState, useRef, useEffect } from "react";
|
||||
import { useContext, useRef } from "react";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { setShouldAddFileForEditing } from "../../redux/slices/uiStateSlice";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { addCodeToEdit } from "../../redux/slices/editModeState";
|
||||
import { Listbox } from "@headlessui/react";
|
||||
|
||||
export default function AddFileButton() {
|
||||
export interface AddFileButtonProps {
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
export default function AddFileButton({ onClick }: AddFileButtonProps) {
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
function onClickAddFileToCodeToEdit() {
|
||||
dispatch(setShouldAddFileForEditing(true));
|
||||
}
|
||||
|
||||
async function handleAddAllOpenFiles() {
|
||||
const openFiles = await ideMessenger.ide.getOpenFiles();
|
||||
const filesData = await Promise.all(
|
||||
openFiles.map(async (filepath) => {
|
||||
const contents = await ideMessenger.ide.readFile(filepath);
|
||||
return { filepath, contents };
|
||||
}),
|
||||
);
|
||||
|
||||
for (const filepath of openFiles) {
|
||||
const contents = await ideMessenger.ide.readFile(filepath);
|
||||
dispatch(addCodeToEdit({ filepath, contents }));
|
||||
}
|
||||
dispatch(addCodeToEdit(filesData));
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -29,14 +31,14 @@ export default function AddFileButton() {
|
|||
<div className="relative">
|
||||
<Listbox.Button
|
||||
ref={buttonRef}
|
||||
className="bg-vsc-editor-background border-lightgray/50 flex cursor-pointer items-center justify-between rounded-md border border-solid px-0 shadow-sm transition-colors"
|
||||
className="bg-vsc-editor-background border-lightgray/50 flex h-5 cursor-pointer items-center justify-between rounded-md border border-solid px-0 shadow-sm transition-colors"
|
||||
>
|
||||
<div
|
||||
className="flex items-center gap-1 px-1.5 hover:brightness-125"
|
||||
className="flex h-5 w-14 items-center justify-center gap-1 hover:brightness-125"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onClickAddFileToCodeToEdit();
|
||||
onClick();
|
||||
}}
|
||||
>
|
||||
<PlusIcon className="text-vsc-foreground inline h-2.5 w-2.5 brightness-75" />
|
||||
130
gui/src/pages/edit/AddFileCombobox.tsx
Normal file
130
gui/src/pages/edit/AddFileCombobox.tsx
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
import { useState, useContext, useEffect, useRef } from "react";
|
||||
import {
|
||||
ContextSubmenuItemWithProvider,
|
||||
SubmenuContextProvidersContext,
|
||||
} from "../../context/SubmenuContextProviders";
|
||||
import { Combobox } from "@headlessui/react";
|
||||
import FileIcon from "../../components/FileIcon";
|
||||
import { useSelector } from "react-redux";
|
||||
import { RootState } from "../../redux/store";
|
||||
|
||||
export interface AddFileComboboxProps {
|
||||
onSelect: (filepaths: string[]) => void;
|
||||
onEscape: () => void;
|
||||
}
|
||||
|
||||
export default function AddFileCombobox({
|
||||
onSelect,
|
||||
onEscape,
|
||||
}: AddFileComboboxProps) {
|
||||
const [query, setQuery] = useState("");
|
||||
const [selectedFiles, setSelectedFiles] = useState<
|
||||
ContextSubmenuItemWithProvider[]
|
||||
>([]);
|
||||
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const { getSubmenuContextItems } = useContext(SubmenuContextProvidersContext);
|
||||
const allFiles = getSubmenuContextItems("file", "");
|
||||
const codeToEdit = useSelector(
|
||||
(state: RootState) => state.editModeState.codeToEdit,
|
||||
);
|
||||
const remainingFiles = allFiles.filter(
|
||||
(file) => !codeToEdit.find((code) => code.filepath === file.id),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (inputRef.current) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const filteredFiles =
|
||||
query === ""
|
||||
? remainingFiles
|
||||
: remainingFiles.filter((file) =>
|
||||
file.title.toLowerCase().includes(query.toLowerCase()),
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="pb-2 pl-3.5 pr-2">
|
||||
<Combobox
|
||||
multiple
|
||||
value={selectedFiles}
|
||||
onChange={(files) => {
|
||||
setSelectedFiles(files);
|
||||
onSelect(files.map((file) => file.id));
|
||||
buttonRef.current?.click();
|
||||
}}
|
||||
>
|
||||
{({ open }) => (
|
||||
<div className="relative">
|
||||
<Combobox.Button className="hidden" ref={buttonRef} />
|
||||
<Combobox.Input
|
||||
ref={inputRef}
|
||||
onClick={() => {
|
||||
if (!open) {
|
||||
buttonRef.current?.click();
|
||||
}
|
||||
}}
|
||||
onFocus={() => {
|
||||
buttonRef.current?.click();
|
||||
}}
|
||||
className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 focus:outline-none"
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder="Type to search files..."
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape" && !open) {
|
||||
onEscape();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Combobox.Options className="no-scrollbar bg-vsc-editor-background border-lightgray/50 absolute left-0 right-0 z-50 mt-1 max-h-60 overflow-y-auto overflow-x-hidden rounded-md border border-solid px-1 py-0 pl-0 pr-5 shadow-lg focus:outline-none">
|
||||
{filteredFiles.length > 0 ? (
|
||||
filteredFiles.map((file) => (
|
||||
<Combobox.Option
|
||||
key={file.id}
|
||||
value={file}
|
||||
className={({ active }) =>
|
||||
`relative flex w-full cursor-pointer px-2 py-1 text-left text-xs ${
|
||||
active
|
||||
? "bg-vsc-list-active-background text-vsc-list-active-foreground"
|
||||
: ""
|
||||
}`
|
||||
}
|
||||
>
|
||||
{({ active, selected }) => (
|
||||
<div className="group flex w-full min-w-0 items-center gap-1">
|
||||
<div className="flex min-w-0 flex-1 items-center gap-1">
|
||||
<FileIcon
|
||||
height="20px"
|
||||
width="20px"
|
||||
filename={file.title}
|
||||
/>
|
||||
<span className="truncate">{file.title}</span>
|
||||
</div>
|
||||
|
||||
<span
|
||||
className={`text-lightgray max-w-[30%] truncate ${
|
||||
active || selected ? "visible" : "invisible"
|
||||
} group-hover:visible`}
|
||||
>
|
||||
{file.description}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</Combobox.Option>
|
||||
))
|
||||
) : (
|
||||
<div className="text-vsc-list-active-foreground0 px-2 py-1 text-xs">
|
||||
No results
|
||||
</div>
|
||||
)}
|
||||
</Combobox.Options>
|
||||
</div>
|
||||
)}
|
||||
</Combobox>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
97
gui/src/pages/edit/CodeToEdit.tsx
Normal file
97
gui/src/pages/edit/CodeToEdit.tsx
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import { useContext, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import {
|
||||
removeCodeToEdit,
|
||||
addCodeToEdit,
|
||||
} from "../../redux/slices/editModeState";
|
||||
import { RootState } from "../../redux/store";
|
||||
import CodeToEditListItem from "./CodeToEditListItem";
|
||||
import { CodeToEdit, RangeInFileWithContents } from "core";
|
||||
import AddFileButton from "./AddFileButton";
|
||||
import AddFileCombobox from "./AddFileCombobox";
|
||||
import { XMarkIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
export default function WorkingSet() {
|
||||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const [showAddFileCombobox, setShowAddFileCombobox] = useState(false);
|
||||
const codeToEdit = useSelector(
|
||||
(state: RootState) => state.editModeState.codeToEdit,
|
||||
);
|
||||
|
||||
const title =
|
||||
codeToEdit.length === 0
|
||||
? "Code to edit"
|
||||
: codeToEdit.length === 1
|
||||
? "Code to edit (1 item)"
|
||||
: `Code to edit (${codeToEdit.length} items)`;
|
||||
|
||||
function onDelete(rif: RangeInFileWithContents) {
|
||||
dispatch(removeCodeToEdit(rif));
|
||||
}
|
||||
|
||||
function onClickFilename(code: CodeToEdit) {
|
||||
if ("range" in code) {
|
||||
ideMessenger.ide.showLines(
|
||||
code.filepath,
|
||||
code.range.start.line,
|
||||
code.range.end.line,
|
||||
);
|
||||
} else {
|
||||
ideMessenger.ide.openFile(code.filepath);
|
||||
}
|
||||
}
|
||||
|
||||
async function onSelectFilesToAdd(filepaths: string[]) {
|
||||
const filePromises = filepaths.map(async (filepath) => {
|
||||
const contents = await ideMessenger.ide.readFile(filepath);
|
||||
return { contents, filepath };
|
||||
});
|
||||
|
||||
const fileResults = await Promise.all(filePromises);
|
||||
|
||||
for (const file of fileResults) {
|
||||
dispatch(addCodeToEdit(file));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-vsc-editor-background border-vsc-input-border mx-1 flex flex-col rounded-t-lg border border-b-0 border-solid px-1">
|
||||
<div className="text-lightgray flex items-center justify-between gap-1.5 py-1.5 pl-3 pr-2 text-xs">
|
||||
<span>{title}</span>
|
||||
<AddFileButton onClick={() => setShowAddFileCombobox(true)} />
|
||||
</div>
|
||||
|
||||
{codeToEdit.length > 0 && (
|
||||
<ul className="no-scrollbar my-0 mb-1.5 max-h-[50vh] list-outside list-none overflow-y-auto pl-0">
|
||||
{codeToEdit.map((code, i) => (
|
||||
<CodeToEditListItem
|
||||
key={code.filepath + i}
|
||||
code={code}
|
||||
onDelete={onDelete}
|
||||
onClickFilename={onClickFilename}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{showAddFileCombobox && (
|
||||
<div className="mr-2 flex items-center py-1">
|
||||
<div className="flex-grow">
|
||||
<AddFileCombobox
|
||||
onSelect={onSelectFilesToAdd}
|
||||
onEscape={() => setShowAddFileCombobox(false)}
|
||||
/>
|
||||
</div>
|
||||
<XMarkIcon
|
||||
onClick={(e) => {
|
||||
setShowAddFileCombobox(false);
|
||||
}}
|
||||
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground mb-2 h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ export default function CodeToEditListItem({
|
|||
onClick={() => setShowCodeSnippet((showCodeSnippet) => !showCodeSnippet)}
|
||||
>
|
||||
<div
|
||||
className={`hover:bg-lightgray hover:text-vsc-foreground flex justify-between rounded px-2 py-1 transition-colors hover:bg-opacity-20 ${showCodeSnippet && "text-vsc-foreground bg-lightgray bg-opacity-20"}`}
|
||||
className={`hover:bg-lightgray hover:text-vsc-foreground flex justify-between rounded px-2 py-0.5 transition-colors hover:bg-opacity-20 ${showCodeSnippet && "text-vsc-foreground bg-lightgray bg-opacity-20"}`}
|
||||
>
|
||||
<div className="flex items-center gap-0.5">
|
||||
{showCodeSnippet ? (
|
||||
|
|
@ -1,37 +1,80 @@
|
|||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate, useRouteError } from "react-router-dom";
|
||||
import { newSession } from "../redux/slices/stateSlice";
|
||||
import ContinueButton from "../components/mainInput/ContinueButton";
|
||||
import { vscBackground } from "../components";
|
||||
import { GithubIcon } from "../components/svg/GithubIcon";
|
||||
import { DiscordIcon } from "../components/svg/DiscordIcon";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { Button, SecondaryButton } from "../components";
|
||||
import { ArrowPathIcon, FlagIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
export default function ErrorPage() {
|
||||
const GITHUB_LINK = "https://github.com/continuedev/continue/issues/new/choose";
|
||||
const DISCORD_LINK = "https://discord.com/invite/EfJEfdFnDQ";
|
||||
|
||||
const ErrorPage: React.FC = () => {
|
||||
const error: any = useRouteError();
|
||||
console.error(error);
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const messenger = useContext(IdeMessengerContext);
|
||||
const openUrl = (url: string) => {
|
||||
if (messenger) {
|
||||
messenger.post("openUrl", url);
|
||||
}
|
||||
};
|
||||
|
||||
const [initialLoad, setInitialLoad] = useState(true);
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
setInitialLoad(false);
|
||||
}, 500);
|
||||
}, []);
|
||||
return (
|
||||
<div
|
||||
id="error-page"
|
||||
className="text-center"
|
||||
style={{ backgroundColor: vscBackground }}
|
||||
>
|
||||
<h1>Error in Continue React App</h1>
|
||||
<p>
|
||||
<i>{error.statusText || error.message}</i>
|
||||
</p>
|
||||
<br />
|
||||
<p>Click below to Continue</p>
|
||||
<br />
|
||||
<ContinueButton
|
||||
disabled={false}
|
||||
showStop={false}
|
||||
<div className="bg- flex min-h-screen flex-col items-center justify-center px-8 py-4 text-center">
|
||||
<h1 className="mb-4 text-3xl font-bold">Error in Continue UI</h1>
|
||||
|
||||
<pre className="pb-6">
|
||||
<code className="px-3 py-2">{error.statusText || error.message}</code>
|
||||
</pre>
|
||||
|
||||
<Button
|
||||
className="flex flex-row items-center gap-2"
|
||||
onClick={() => {
|
||||
dispatch(newSession());
|
||||
localStorage.removeItem("persist:root");
|
||||
localStorage.removeItem("inputHistory_chat");
|
||||
// localStorage.removeItem("showTutorialCard");
|
||||
// localStorage.removeItem("onboardingStatus");
|
||||
// localStorage.removeItem("lastSessionId");
|
||||
navigate("/");
|
||||
}}
|
||||
></ContinueButton>
|
||||
>
|
||||
{initialLoad ? (
|
||||
<FlagIcon className="h-5 w-5 text-red-600" />
|
||||
) : (
|
||||
<ArrowPathIcon className="h-5 w-5" />
|
||||
)}
|
||||
Continue
|
||||
</Button>
|
||||
|
||||
<p className="mb-0 mt-6">Report the issue:</p>
|
||||
<div className="mt-4 flex space-x-4">
|
||||
<SecondaryButton
|
||||
onClick={() => openUrl(GITHUB_LINK)}
|
||||
className="flex items-center space-x-2 rounded-lg px-4 py-2 text-white"
|
||||
>
|
||||
<GithubIcon size={20} />
|
||||
</SecondaryButton>
|
||||
<SecondaryButton
|
||||
onClick={() => openUrl(DISCORD_LINK)}
|
||||
className="flex items-center rounded-lg"
|
||||
>
|
||||
<DiscordIcon size={20} />
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default ErrorPage;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue