diff --git a/agent.mjs b/agent.mjs index 05f47b0..10c06cd 100644 --- a/agent.mjs +++ b/agent.mjs @@ -10,8 +10,7 @@ import { OllamaEmbedding } from '@llamaindex/ollama'; import { OpenAI } from '@llamaindex/openai'; import { Graph } from 'graphology'; -const STORAGE_DIR = './storage'; -const GRAPH_FILE = './graph.json'; +import { STORAGE_DIR, GRAPH_FILE } from './constants.mjs'; // Configure Settings Settings.embedModel = new OllamaEmbedding({ diff --git a/build_graph.mjs b/build_graph.mjs index 42a4c93..9c6cd97 100644 --- a/build_graph.mjs +++ b/build_graph.mjs @@ -6,7 +6,7 @@ import { Graph } from 'graphology'; const SPEC_DIR = './spec-built/multipage'; const CODE_DIR = './engine262/src'; -const GRAPH_FILE = './graph.json'; +import { GRAPH_FILE } from './constants.mjs'; async function buildGraph() { const graph = new Graph({ multi: true }); diff --git a/constants.mjs b/constants.mjs new file mode 100644 index 0000000..e29e204 --- /dev/null +++ b/constants.mjs @@ -0,0 +1,2 @@ +export const STORAGE_DIR = './storage'; +export const GRAPH_FILE = './graphology/graph.json'; \ No newline at end of file diff --git a/ingest.mjs b/ingest.mjs index 7d72b7c..4a03dda 100644 --- a/ingest.mjs +++ b/ingest.mjs @@ -18,7 +18,7 @@ Settings.embedModel = new OllamaEmbedding({ const SPEC_DIR = './spec-built/multipage'; const CODE_DIR = './engine262/src'; -const STORAGE_DIR = './storage'; +import { STORAGE_DIR } from './constants.mjs'; // Initialize a SentenceSplitter with even smaller chunk size const sentenceSplitter = new SentenceSplitter({ chunkSize: 256, chunkOverlap: 20 }); @@ -113,7 +113,7 @@ async function main() { } } - console.log("Index built and persisted to ./storage"); + console.log(`Index built and persisted to ${STORAGE_DIR}`); } main().catch(console.error);