chore: Type-check fixes

This commit is contained in:
2026-03-27 17:48:02 +05:30
parent 0f5a31137f
commit 28c26d319e
4 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import fs from "node:fs"; import fs from "node:fs";
import { OllamaEmbedding } from "@llamaindex/ollama"; import { OllamaEmbedding } from "@llamaindex/ollama";
import { OpenAI } from "@llamaindex/openai"; import { OpenAI } from "@llamaindex/openai";
import { Graph } from "graphology"; import Graph from "graphology";
import { import {
QueryEngineTool, QueryEngineTool,
ReActAgent, ReActAgent,
@@ -10,7 +10,7 @@ import {
VectorStoreIndex, VectorStoreIndex,
} from "llamaindex"; } from "llamaindex";
import { GRAPH_FILE, STORAGE_DIR } from "./constants.ts"; import { GRAPH_FILE, STORAGE_DIR } from "./constants";
// Configure Settings // Configure Settings
Settings.embedModel = new OllamaEmbedding({ Settings.embedModel = new OllamaEmbedding({
@@ -74,7 +74,7 @@ async function main() {
required: ["query"], required: ["query"],
}, },
}, },
call: async ({ query }) => { call: async ({ query }: { query: string }) => {
console.log(`[Tool: graph_explorer] Querying for: ${query}`); console.log(`[Tool: graph_explorer] Querying for: ${query}`);
let nodeId = query; let nodeId = query;
if (!graph.hasNode(nodeId)) { if (!graph.hasNode(nodeId)) {
+2 -2
View File
@@ -2,12 +2,12 @@ import fs from "node:fs";
import path from "node:path"; import path from "node:path";
import * as cheerio from "cheerio"; import * as cheerio from "cheerio";
import { glob } from "glob"; import { glob } from "glob";
import { Graph } from "graphology"; import Graph from "graphology";
const SPEC_DIR = "./spec-built/multipage"; const SPEC_DIR = "./spec-built/multipage";
const CODE_DIR = "./engine262/src"; const CODE_DIR = "./engine262/src";
import { GRAPH_FILE } from "../constants.ts"; import { GRAPH_FILE } from "../constants";
async function buildGraph() { async function buildGraph() {
const graph = new Graph({ multi: true }); const graph = new Graph({ multi: true });
+3 -3
View File
@@ -19,7 +19,7 @@ Settings.embedModel = new OllamaEmbedding({
const SPEC_DIR = "./spec-built/multipage"; const SPEC_DIR = "./spec-built/multipage";
const _CODE_DIR = "./engine262/src"; const _CODE_DIR = "./engine262/src";
import { STORAGE_DIR } from "../constants.ts"; import { STORAGE_DIR } from "../constants";
// Initialize a SentenceSplitter with even smaller chunk size // Initialize a SentenceSplitter with even smaller chunk size
const sentenceSplitter = new SentenceSplitter({ const sentenceSplitter = new SentenceSplitter({
@@ -29,7 +29,7 @@ const sentenceSplitter = new SentenceSplitter({
async function ingestSpec() { async function ingestSpec() {
const htmlFiles = await glob(path.join(SPEC_DIR, "*.html")); const htmlFiles = await glob(path.join(SPEC_DIR, "*.html"));
const documents = []; const documents: Document[] = [];
for (const file of htmlFiles) { for (const file of htmlFiles) {
const content = fs.readFileSync(file, "utf-8"); 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)..."); console.log("Building index (this might take a while with local Ollama)...");
const BATCH_SIZE = 50; const BATCH_SIZE = 50;
let index; let index: any;
// Try to load existing index if any // Try to load existing index if any
try { try {
+1 -1
View File
@@ -14,4 +14,4 @@
}, },
"include": ["**/*.ts"], "include": ["**/*.ts"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist"]
} }