Skip to content

Commit 49b6fc8

Browse files
committed
refactor: Improve commit embedding logic and error handling
1 parent 1b5bee1 commit 49b6fc8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/lib/repository.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,15 +585,19 @@ async function indexCommitsAndDiffs(
585585
parent_oids: commit.parents,
586586
repositoryPath: repoPath, // Optional
587587
};
588+
589+
// Now attempt embedding
590+
const commitVector = await llmProvider.generateEmbedding(commitTextToEmbed);
591+
588592
pointsToUpsert.push({
589-
// Generate UUID for commit pointId
590-
id: uuidv5(`commit:${repoPath}:${commit.oid}`, CODECOMPASS_NAMESPACE),
593+
id: commitPointId,
591594
vector: commitVector,
592595
payload: commitPayload,
593596
});
594597
} catch (embedError) {
595-
logger.error(`Failed to generate embedding for commit ${commit.oid}`, { error: embedError instanceof Error ? embedError.message : String(embedError) });
596-
continue; // Skip this commit if embedding fails
598+
// This catch block will now primarily catch errors from llmProvider.generateEmbedding
599+
logger.error(`Failed to process or generate embedding for commit ${commit.oid}`, { error: embedError instanceof Error ? embedError.message : String(embedError) });
600+
continue; // Skip this commit if ID generation or embedding fails
597601
}
598602

599603

0 commit comments

Comments
 (0)