File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed
ai-assistant/src/endpoints Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -33,40 +33,6 @@ namespace Helpers {
3333 export async function insertNodes ( db : IDB , nodes : DBNode [ ] ) {
3434 await Promise . all ( nodes . map ( ( node ) => insertNode ( db , node ) ) ) ;
3535 }
36-
37- async function establishRelation (
38- db : IDB ,
39- sourceID : string ,
40- targetID : string ,
41- relation : string
42- ) {
43- const query = [
44- `MATCH (n { id: $sourceID })` ,
45- `MATCH (m { id: $targetID })` ,
46- `CREATE (n)-[:${ relation } ]->(m)\n` ,
47- ] . join ( "\n" ) ;
48- try {
49- await db . run ( query , { sourceID, targetID } ) ;
50- } catch ( e ) {
51- console . error ( e ) ;
52- }
53- }
54-
55- export async function establishRelations ( db : IDB , nodes : DBNode [ ] ) {
56- const jobs : Promise < any > [ ] = [ ] ;
57- for ( const node of nodes ) {
58- for ( const relation of node . relations ) {
59- const job = establishRelation (
60- db ,
61- node . id ,
62- relation . target ,
63- relation . relation
64- ) ;
65- jobs . push ( job ) ;
66- }
67- }
68- await Promise . all ( jobs ) ;
69- }
7036}
7137
7238export class IngestEndpoint extends ApiEndpoint {
You can’t perform that action at this time.
0 commit comments