Skip to content

Commit d378759

Browse files
committed
Merge branch 'feature/233-implement-openrouter' of https://github.com/landamessenger/git-board-flow into feature/233-implement-openrouter
2 parents ccd9c17 + b756343 commit d378759

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

dist/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131792,6 +131792,24 @@ class SupabaseRepository {
131792131792
throw error;
131793131793
}
131794131794
};
131795+
this.removeChunksByShasum = async (owner, repository, branch, shasum) => {
131796+
try {
131797+
const { error } = await this.supabase
131798+
.from(this.CHUNKS_TABLE)
131799+
.delete()
131800+
.eq('owner', owner)
131801+
.eq('repository', repository)
131802+
.eq('branch', branch)
131803+
.eq('shasum', shasum);
131804+
if (error) {
131805+
throw error;
131806+
}
131807+
}
131808+
catch (error) {
131809+
(0, logger_1.logError)(`Error removing chunks by shasum: ${JSON.stringify(error, null, 2)}`);
131810+
throw error;
131811+
}
131812+
};
131795131813
this.getChunkedFileByShasum = async (owner, repository, branch, type, shasum) => {
131796131814
try {
131797131815
const { data, error } = await this.supabase
@@ -135715,6 +135733,8 @@ class VectorActionUseCase {
135715135733
}
135716135734
else if (remoteChunkedFiles.length > 0 && remoteChunkedFiles.length !== chunkedFile.chunks.length) {
135717135735
(0, logger_1.logDebugInfo)(`📦 ❌ Chunk has a different number of chunks in Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
135736+
await supabaseRepository.removeChunksByShasum(param.owner, param.repo, param.commit.branch, chunkedFile.shasum);
135737+
(0, logger_1.logDebugInfo)(`📦 🗑️ Chunks removed from Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
135718135738
}
135719135739
(0, logger_1.logSingleLine)(`🟡 ${i + 1}/${totalFiles} (${progress.toFixed(1)}%) - Estimated time remaining: ${Math.ceil(remainingTime)} seconds | Vectorizing [${chunkedFile.path}]`);
135720135740
const embeddings = await this.dockerRepository.getEmbedding(param, chunkedFile.chunks.map(chunk => [chunkedFile.type === 'block' ? this.CODE_INSTRUCTION_BLOCK : this.CODE_INSTRUCTION_LINE, chunk]));

dist/src/data/repository/supabase_repository.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export declare class SupabaseRepository {
88
private supabase;
99
constructor(config: SupabaseConfig);
1010
setChunkedFile: (owner: string, repository: string, branch: string, chunkedFile: ChunkedFile) => Promise<void>;
11+
removeChunksByShasum: (owner: string, repository: string, branch: string, shasum: string) => Promise<void>;
1112
getChunkedFileByShasum: (owner: string, repository: string, branch: string, type: string, shasum: string) => Promise<ChunkedFileChunk[]>;
1213
getChunks: (owner: string, repository: string, branch: string, path: string, type: string, index: number) => Promise<ChunkedFileChunk[]>;
1314
getChunksByShasum: (owner: string, repository: string, branch: string, shasum: string) => Promise<ChunkedFileChunk[]>;

dist/src/data/repository/supabase_repository.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ class SupabaseRepository {
3939
throw error;
4040
}
4141
};
42+
this.removeChunksByShasum = async (owner, repository, branch, shasum) => {
43+
try {
44+
const { error } = await this.supabase
45+
.from(this.CHUNKS_TABLE)
46+
.delete()
47+
.eq('owner', owner)
48+
.eq('repository', repository)
49+
.eq('branch', branch)
50+
.eq('shasum', shasum);
51+
if (error) {
52+
throw error;
53+
}
54+
}
55+
catch (error) {
56+
(0, logger_1.logError)(`Error removing chunks by shasum: ${JSON.stringify(error, null, 2)}`);
57+
throw error;
58+
}
59+
};
4260
this.getChunkedFileByShasum = async (owner, repository, branch, type, shasum) => {
4361
try {
4462
const { data, error } = await this.supabase

dist/src/usecase/vector_action_use_case.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class VectorActionUseCase {
6868
}
6969
else if (remoteChunkedFiles.length > 0 && remoteChunkedFiles.length !== chunkedFile.chunks.length) {
7070
(0, logger_1.logDebugInfo)(`📦 ❌ Chunk has a different number of chunks in Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
71+
await supabaseRepository.removeChunksByShasum(param.owner, param.repo, param.commit.branch, chunkedFile.shasum);
72+
(0, logger_1.logDebugInfo)(`📦 🗑️ Chunks removed from Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
7173
}
7274
(0, logger_1.logSingleLine)(`🟡 ${i + 1}/${totalFiles} (${progress.toFixed(1)}%) - Estimated time remaining: ${Math.ceil(remainingTime)} seconds | Vectorizing [${chunkedFile.path}]`);
7375
const embeddings = await this.dockerRepository.getEmbedding(param, chunkedFile.chunks.map(chunk => [chunkedFile.type === 'block' ? this.CODE_INSTRUCTION_BLOCK : this.CODE_INSTRUCTION_LINE, chunk]));

0 commit comments

Comments
 (0)