Handle binary blobs (#1493)

This commit is contained in:
John Wang 2024-06-16 10:25:34 -07:00 • committed by GitHub
parent 5edc0cba7e
commit 791a75f7a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,15 +79,26 @@ export class LanceDbIndex implements CodebaseIndex {
const content = contents[i];
const chunks: Chunk[] = [];
let hasEmptyChunks = false;
for await (const chunk of chunkDocument(
items[i].path,
content,
LanceDbIndex.MAX_CHUNK_SIZE,
items[i].cacheKey,
)) {
if (chunk.content.length == 0) {
hasEmptyChunks = true;
break;
}
chunks.push(chunk);
}
if (hasEmptyChunks) {
// File did not chunk properly, let's skip it.
continue;
}
if (chunks.length > 20) {
// Too many chunks to index, probably a larger file than we want to include
continue;