Skip to content

Commit 30c598d

Browse files
committed
Fixed database queries for purging
1 parent f8e8d75 commit 30c598d

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

ai-assistant/src/core/services/db/neo4j.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export class Neo4j implements IDB {
3636
// this.baseUrl = "http://neo4j:7474";
3737
// this.username = "neo4j";
3838
// this.password = "strongpasswordsafe123";
39-
this.baseUrl = "http://44.202.213.161:7474";
39+
this.baseUrl = "http://44.192.104.170:7474";
4040
this.username = "neo4j";
41-
this.password = "advance-polarity-flake";
41+
this.password = "individuals-societies-wools";
4242
}
4343

4444
private async sendRequest(
@@ -59,6 +59,8 @@ export class Neo4j implements IDB {
5959
data: data,
6060
});
6161

62+
console.log(res);
63+
6264
if (!res || ![200, 201].includes(res.statusCode) || !res.content) {
6365
return null;
6466
}

ai-assistant/src/endpoints/purgeDB.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@ export class PurgeDBEndpoint extends ApiEndpoint {
2323

2424
async setupIndices(db: IDB) {
2525
const query = [
26-
// Drop existing indices
27-
["DROP INDEX `nameEmbeddings`;"],
28-
["DROP INDEX `codeEmbeddings`;"],
29-
3026
// Create indices for name embeddings
3127
[
32-
"CREATE VECTOR INDEX `nameEmbeddings`",
28+
"CREATE VECTOR INDEX `nameEmbeddings` IF NOT EXISTS",
3329
"FOR (n: Node) ON (n.nameEmbeddings)",
3430
"OPTIONS {indexConfig: {",
3531
" `vector.dimensions`: 384,",
@@ -39,7 +35,7 @@ export class PurgeDBEndpoint extends ApiEndpoint {
3935

4036
// Create indices for code embeddings
4137
[
42-
"CREATE VECTOR INDEX `codeEmbeddings`",
38+
"CREATE VECTOR INDEX `codeEmbeddings` IF NOT EXISTS",
4339
"FOR (n: Node) ON (n.codeEmbeddings)",
4440
"OPTIONS {indexConfig: {",
4541
" `vector.dimensions`: 384,",
@@ -61,8 +57,8 @@ export class PurgeDBEndpoint extends ApiEndpoint {
6157
): Promise<IApiResponse> {
6258
const db = new Neo4j(http);
6359

64-
await this.emptyDB(db);
6560
await this.setupIndices(db);
61+
await this.emptyDB(db);
6662

6763
return this.success();
6864
}

0 commit comments

Comments
 (0)