Skip to content

Commit 06e1703

Browse files
committed
fix: Fix invalid UUID error by using uuidv4
1 parent 760e49b commit 06e1703

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/lib/qdrant.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ export async function batchUpsertVectors(
102102
for (let i = 0; i < points.length; i += batchSize) {
103103
const batch = points.slice(i, i + batchSize);
104104
try {
105+
// TEMPORARY DEBUG LOG:
106+
logger.debug(`[DEBUG QDRANT IDs] Batch ${Math.floor(i / batchSize) + 1} IDs: ${JSON.stringify(batch.map(p => p.id))}`);
107+
105108
await withRetry(async () => {
106109
// The js-client-rest library expects points to be an object { points: PointStruct[] }
107110
// or just PointStruct[] if using client.upsertPoints

src/lib/repository.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as Diff from 'diff';
1616
// import { Buffer } from 'buffer'; // Buffer is global in Node.js
1717
import { configService, logger } from "./config-service";
1818
// import { generateEmbedding } from "./ollama"; // We will use llmProvider.generateEmbedding() instead.
19-
import { v5 as uuidv5 } from 'uuid'; // Import uuidv5
19+
import { v4 as uuidv4 } from 'uuid'; // Import uuidv4
2020
import nodeFs from 'fs'; // Standard fs for isomorphic-git functions requiring it
2121
import { batchUpsertVectors } from './qdrant';
2222

@@ -37,9 +37,6 @@ export interface CommitDetail {
3737
changedFiles: CommitChange[];
3838
}
3939

40-
// Define a namespace for UUID generation (this can be any valid UUID)
41-
const CODECOMPASS_NAMESPACE = 'f1a2b3c4-d5e6-7890-1234-567890abcdef';
42-
4340
export async function validateGitRepository(repoPath: string): Promise<boolean> {
4441
try {
4542
const gitdir = path.join(repoPath, ".git");
@@ -187,8 +184,7 @@ export async function indexRepository(qdrantClient: QdrantClient, repoPath: stri
187184
// Embed the preprocessed chunk
188185
const embedding = await llmProvider.generateEmbedding(chunkContent); // Use llmProvider
189186
// Generate UUID for pointId
190-
const idContentFileChunk = `file:${repoPath}:${filepath}:chunk:${i}`;
191-
const pointId = uuidv5(idContentFileChunk, CODECOMPASS_NAMESPACE);
187+
const pointId = uuidv4();
192188

193189
const payload: FileChunkPayload = {
194190
dataType: 'file_chunk',
@@ -573,7 +569,7 @@ async function indexCommitsAndDiffs(
573569
continue;
574570
}
575571
// Generate commit ID first
576-
const commitPointId = uuidv5(`commit:${String(repoPath)}:${String(commit.oid)}`, CODECOMPASS_NAMESPACE);
572+
const commitPointId = uuidv4();
577573
const commitPayload: CommitInfoPayload = { // Define payload before embedding attempt
578574
dataType: 'commit_info',
579575
commit_oid: commit.oid,
@@ -625,7 +621,7 @@ async function indexCommitsAndDiffs(
625621
continue;
626622
}
627623
// Generate diff ID first
628-
const diffPointId = uuidv5(`diff:${String(repoPath)}:${String(commit.oid)}:${String(changedFile.path)}:chunk:${i}`, CODECOMPASS_NAMESPACE);
624+
const diffPointId = uuidv4();
629625
const diffPayload: DiffChunkPayload = { // Define payload before embedding
630626
dataType: 'diff_chunk',
631627
commit_oid: commit.oid,

0 commit comments

Comments
 (0)