From 28c26d319e94eff6ef030f2e2cddabb5e306919a Mon Sep 17 00:00:00 2001 From: bendtherules Date: Fri, 27 Mar 2026 17:48:02 +0530 Subject: [PATCH] chore: Type-check fixes --- agent.ts | 6 +++--- setup/build_graph.ts | 4 ++-- setup/ingest.ts | 6 +++--- tsconfig.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/agent.ts b/agent.ts index e4296a2..340afa2 100644 --- a/agent.ts +++ b/agent.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import { OllamaEmbedding } from "@llamaindex/ollama"; import { OpenAI } from "@llamaindex/openai"; -import { Graph } from "graphology"; +import Graph from "graphology"; import { QueryEngineTool, ReActAgent, @@ -10,7 +10,7 @@ import { VectorStoreIndex, } from "llamaindex"; -import { GRAPH_FILE, STORAGE_DIR } from "./constants.ts"; +import { GRAPH_FILE, STORAGE_DIR } from "./constants"; // Configure Settings Settings.embedModel = new OllamaEmbedding({ @@ -74,7 +74,7 @@ async function main() { required: ["query"], }, }, - call: async ({ query }) => { + call: async ({ query }: { query: string }) => { console.log(`[Tool: graph_explorer] Querying for: ${query}`); let nodeId = query; if (!graph.hasNode(nodeId)) { diff --git a/setup/build_graph.ts b/setup/build_graph.ts index 67dd510..73d6a8c 100644 --- a/setup/build_graph.ts +++ b/setup/build_graph.ts @@ -2,12 +2,12 @@ import fs from "node:fs"; import path from "node:path"; import * as cheerio from "cheerio"; import { glob } from "glob"; -import { Graph } from "graphology"; +import Graph from "graphology"; const SPEC_DIR = "./spec-built/multipage"; const CODE_DIR = "./engine262/src"; -import { GRAPH_FILE } from "../constants.ts"; +import { GRAPH_FILE } from "../constants"; async function buildGraph() { const graph = new Graph({ multi: true }); diff --git a/setup/ingest.ts b/setup/ingest.ts index adb2d41..30b473e 100644 --- a/setup/ingest.ts +++ b/setup/ingest.ts @@ -19,7 +19,7 @@ Settings.embedModel = new OllamaEmbedding({ const SPEC_DIR = "./spec-built/multipage"; const _CODE_DIR = "./engine262/src"; -import { STORAGE_DIR } from "../constants.ts"; +import { STORAGE_DIR } from "../constants"; // Initialize a SentenceSplitter with even smaller chunk size const sentenceSplitter = new SentenceSplitter({ @@ -29,7 +29,7 @@ const sentenceSplitter = new SentenceSplitter({ async function ingestSpec() { const htmlFiles = await glob(path.join(SPEC_DIR, "*.html")); - const documents = []; + const documents: Document[] = []; for (const file of htmlFiles) { const content = fs.readFileSync(file, "utf-8"); @@ -97,7 +97,7 @@ async function main() { console.log("Building index (this might take a while with local Ollama)..."); const BATCH_SIZE = 50; - let index; + let index: any; // Try to load existing index if any try { diff --git a/tsconfig.json b/tsconfig.json index 273637b..dc91905 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,4 +14,4 @@ }, "include": ["**/*.ts"], "exclude": ["node_modules", "dist"] -} \ No newline at end of file +}