Skip to content

Commit b78d00a

Browse files
committed
fix: update collection name generation to include workspace basename
1 parent a922ad0 commit b78d00a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/services/code-index/vector-store/__tests__/local-vector-store.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ describe("LocalVectorStore", () => {
4848
})
4949

5050
it("constructor should generate correct collectionName and dbPath", () => {
51-
expect(store["collectionName"]).toBe("ws-mockhashmockhash")
52-
expect(store["dbPath"]).toMatch(/\.roo[\/\\]vector[\/\\]ws-mockhashmockhash[\/\\]vector-store\.db$/)
51+
expect(store["collectionName"]).toBe("workspace-mockhashmockhash")
52+
expect(store["dbPath"]).toMatch(/\.roo[\/\\]vector[\/\\]workspace-mockhashmockhash[\/\\]vector-store\.db$/)
5353
})
5454

5555
describe("initialize", () => {

src/services/code-index/vector-store/local-vector-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export class LocalVectorStore implements IVectorStore {
1919

2020
constructor(workspacePath: string, vectorSize: number, dbDirectory: string) {
2121
this.vectorSize = vectorSize
22-
22+
const basename = path.basename(workspacePath)
2323
// Generate collection name from workspace path
2424
const hash = createHash("sha256").update(workspacePath).digest("hex")
25-
this.collectionName = `ws-${hash.substring(0, 16)}`
25+
this.collectionName = `${basename}-${hash.substring(0, 16)}`
2626
// Set up database path
2727
this.dbPath = path.join(dbDirectory, this.collectionName, `vector-store.db`)
2828
}

0 commit comments

Comments
 (0)