Merge branch 'dev' into pe/codebase-index-update-testing

This commit is contained in:
Patrick Erichsen 2024-08-15 17:43:25 -07:00
commit ccd6894ab3
3 changed files with 24 additions and 19 deletions

View file

@ -216,7 +216,7 @@ export class LanceDbIndex implements CodebaseIndex {
// Compute
const addComputedLanceDbRows = async (
pathAndCacheKey: PathAndCacheKey,
pathAndCacheKeys: PathAndCacheKey[],
computedRows: LanceDbRow[],
) => {
// Create table if needed, add computed rows
@ -236,7 +236,7 @@ export class LanceDbIndex implements CodebaseIndex {
}
// Mark item complete
await markComplete([pathAndCacheKey], IndexResultType.Compute);
await markComplete(pathAndCacheKeys, IndexResultType.Compute);
};
// Check remote cache
@ -285,7 +285,7 @@ export class LanceDbIndex implements CodebaseIndex {
);
}
await addComputedLanceDbRows({ cacheKey, path }, rows);
await addComputedLanceDbRows([{ cacheKey, path }], rows);
}
// Remove items that don't need to be recomputed
@ -306,23 +306,8 @@ export class LanceDbIndex implements CodebaseIndex {
};
const dbRows = await this.computeRows(results.compute);
await this.insertRows(sqliteDb, dbRows);
await Promise.all(
results.compute.map(async (result) => {
await addComputedLanceDbRows(
result,
dbRows.filter(
(row) =>
row.path === result.path && row.cachekey === result.cacheKey,
),
);
}),
);
await markComplete(results.compute, IndexResultType.Compute);
await addComputedLanceDbRows(results.compute, dbRows);
let accumulatedProgress = 0;
// Add tag - retrieve the computed info from lance sqlite cache

View file

@ -24,6 +24,7 @@ const {
copySqliteBinary,
installNodeModuleInTempDirAndCopyToCurrent,
downloadSqliteBinary,
copyTokenizers,
} = require("./utils");
// Clear folders that will be packaged to ensure clean slate
@ -104,6 +105,9 @@ async function package(target, os, arch, exe) {
// *** onnxruntime-node ***
await copyOnnxRuntimeFromNodeModules(target);
// copy llama tokenizers to out
copyTokenizers();
// *** Install @lancedb binary ***
const lancePackageToInstall = {
"darwin-arm64": "@lancedb/vectordb-darwin-arm64",

View file

@ -39,6 +39,20 @@ function copyConfigSchema() {
fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2));
}
function copyTokenizers() {
fs.copyFileSync(
path.join(__dirname, "../../../core/llm/llamaTokenizerWorkerPool.mjs"),
path.join(__dirname, "../out/llamaTokenizerWorkerPool.mjs"),
);
console.log("[info] Copied llamaTokenizerWorkerPool");
fs.copyFileSync(
path.join(__dirname, "../../../core/llm/llamaTokenizer.mjs"),
path.join(__dirname, "../out/llamaTokenizer.mjs"),
);
console.log("[info] Copied llamaTokenizer");
}
function installNodeModules() {
// Make sure we are in the right directory
if (!process.cwd().endsWith("vscode")) {
@ -242,6 +256,7 @@ async function copyNodeModules() {
"@esbuild",
"@lancedb",
"@vscode/ripgrep",
"workerpool"
];
fs.mkdirSync("out/node_modules", { recursive: true });
@ -497,4 +512,5 @@ module.exports = {
installNodeModuleInTempDirAndCopyToCurrent,
downloadSqliteBinary,
downloadRipgrepBinary,
copyTokenizers
};