@@ -18,8 +18,10 @@ export class PurgeDBEndpoint extends ApiEndpoint {
1818
1919 async emptyDB ( db : IDB ) {
2020 const query = `MATCH (n) DETACH DELETE n` ;
21- await db . run ( query ) ;
22- console . error ( "Failed to empty DB" ) ;
21+ const res = await db . run ( query ) ;
22+ if ( ! res ) {
23+ throw new Error ( JSON . stringify ( res ) ) ;
24+ }
2325 }
2426
2527 async setupIndices ( db : IDB ) {
@@ -32,18 +34,17 @@ export class PurgeDBEndpoint extends ApiEndpoint {
3234 "CREATE VECTOR INDEX `nameEmbeddings`" ,
3335 "FOR (n: Node) ON (n.nameEmbeddings)" ,
3436 "OPTIONS {indexConfig: {" ,
35- " `vector.dimensions`: 768 ," ,
37+ " `vector.dimensions`: 384 ," ,
3638 " `vector.similarity_function`: 'COSINE'" ,
3739 "}};" ,
3840
3941 // Create indices for code embeddings
4042 "CREATE VECTOR INDEX `codeEmbeddings`" ,
4143 "FOR (n: Node) ON (n.codeEmbeddings)" ,
4244 "OPTIONS {indexConfig: {" ,
43- " `vector.dimensions`: 768 ," ,
45+ " `vector.dimensions`: 384 ," ,
4446 " `vector.similarity_function`: 'COSINE'" ,
4547 "}};" ,
46-
4748 ] . join ( "\n" ) ;
4849 await db . run ( query ) ;
4950 }
@@ -58,8 +59,8 @@ export class PurgeDBEndpoint extends ApiEndpoint {
5859 ) : Promise < IApiResponse > {
5960 const db = new Neo4j ( http ) ;
6061
61- await this . emptyDB ( db )
62- await this . setupIndices ( db )
62+ await this . emptyDB ( db ) ;
63+ await this . setupIndices ( db ) ;
6364
6465 return this . success ( ) ;
6566 }
0 commit comments