File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
rocket-chatter-ingestion-server/src Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import cliProgress from "cli-progress"
22import { readdirSync } from "fs"
33import { readFile } from "fs/promises"
44import { Transaction } from "neo4j-driver"
5+ import path from "path"
6+
57import { DBNode } from "../../core/dbNode"
68import { db , verifyConnectivity } from "../../core/neo4j"
79
@@ -97,13 +99,16 @@ namespace Algorithms {
9799 }
98100}
99101
100- export async function insertDataIntoDB ( batchSize : number = 50 ) {
102+ export async function insertDataIntoDB (
103+ embeddingsPath : string ,
104+ batchSize : number = 50
105+ ) {
101106 console . log ( await verifyConnectivity ( ) )
102107
103108 console . log ( "🕒 Inserting" )
104109
105- const files = readdirSync ( "./data/embeddings" ) . map (
106- ( file ) => `./data/embeddings/ ${ file } `
110+ const files = readdirSync ( embeddingsPath ) . map ( ( file ) =>
111+ path . resolve ( embeddingsPath , file )
107112 )
108113 const totalNodes = files . length * batchSize
109114
Original file line number Diff line number Diff line change @@ -45,8 +45,12 @@ export class Codebase {
4545 this . makeFilesBatches ( )
4646 }
4747
48+ get embeddingsDirPath ( ) : string {
49+ return this . _embeddingsDirPath
50+ }
51+
4852 private initializeDataDirectory ( removeExisting = true ) : void {
49- this . _dataDirName = `data- ${ Date . now ( ) } `
53+ this . _dataDirName = `data`
5054 this . _dataDirPath = path . resolve ( this . _path , this . _dataDirName )
5155
5256 this . _embeddingsDirName = `${ this . _dataDirName } /embeddings`
Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ import { Codebase } from "./process/prepare/codebase"
22import { FileProcessor } from "./process/prepare/processor/file"
33
44async function main ( ) {
5- const codebase = new Codebase ( "./project" , new FileProcessor ( ) )
5+ const codebase = new Codebase ( "./project" , new FileProcessor ( ) , 1 )
66 await codebase . process ( )
7- await codebase . embed ( )
7+ // await codebase.embed()
8+
9+ // insertDataIntoDB(codebase.embeddingsDirPath, 1)
810}
911
1012main ( )
You can’t perform that action at this time.
0 commit comments