File size: 1,903 Bytes
34367da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as dotenv from 'dotenv';
import * as path from 'path';
dotenv.config({ path: path.resolve(process.cwd(), 'apps/backend/.env') });

import { knowledgeAcquisition } from '../services/KnowledgeAcquisitionService.js';
import { neo4jAdapter } from '../adapters/Neo4jAdapter.js';
import { getPgVectorStore } from '../platform/vector/PgVectorStoreAdapter.js';

async function main() {
    console.log('🚀 Starting ingestion of Target I01 (Nuuday Design Guide)...');

    try {
        // Initialize connections
        console.log('🔌 Connecting to databases...');
        const vectorStore = getPgVectorStore();
        await vectorStore.initialize();

        // Run ingestion
        const result = await knowledgeAcquisition.acquireSingleTarget('I01');

        if (result && result.success) {
            console.log('✅ Ingestion Successful!');
            console.log('-----------------------------------');
            console.log(`📄 Source ID: ${result.sourceId}`);
            console.log(`🧩 Chunks: ${result.chunks}`);
            console.log(`🏷️ Entities: ${result.entitiesExtracted}`);
            console.log(`🔢 Vectors: ${result.vectorsStored}`);
            console.log(`🕸️ Graph Nodes: ${result.graphNodesCreated}`);
            console.log(`⏱️ Duration: ${result.duration}ms`);
            console.log('-----------------------------------');
        } else {
            console.error('❌ Ingestion Failed');
            if (result) {
                console.error('Errors:', result.errors);
            } else {
                console.error('Target I01 not found in KNOWLEDGE_TARGETS.json');
            }
        }

    } catch (error) {
        console.error('💥 Fatal Error:', error);
    } finally {
        // Cleanup
        await neo4jAdapter.close();
        process.exit(0);
    }
}

main();