mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 13:21:55 +00:00
chore: fix biome issues
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import { DynamicStructuredTool } from "@langchain/core/tools";
|
||||
// @ts-ignore - graphology type issue
|
||||
import type Graph from "graphology";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -20,7 +19,7 @@ const graphExplorerSchema = z.object({
|
||||
* Creates the graph explorer tool.
|
||||
* @param graph - Graphology graph instance
|
||||
*/
|
||||
// @ts-ignore - Graph type issue
|
||||
// @ts-expect-error - Graph type issue
|
||||
export function createGraphExplorerTool(graph: Graph) {
|
||||
return new DynamicStructuredTool({
|
||||
name: "ask262_graph_explorer",
|
||||
|
||||
@@ -21,7 +21,7 @@ import { GRAPH_FILE } from "../constants.js";
|
||||
*/
|
||||
async function buildGraph() {
|
||||
// Initialize a multi-graph (allows multiple edges between same nodes)
|
||||
// @ts-ignore - graphology constructor type issue
|
||||
// @ts-expect-error - graphology constructor type issue
|
||||
const graph = new Graph({
|
||||
multi: true,
|
||||
type: "directed",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bun
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import type { CheerioAPI } from "cheerio";
|
||||
import * as cheerio from "cheerio";
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
// Resolve the path to the HTML file (relative to repo root)
|
||||
const htmlUrl = new URL(
|
||||
|
||||
@@ -266,17 +266,17 @@ export function convertTablesToMarkdown($: cheerio.CheerioAPI): void {
|
||||
// Header row
|
||||
if (rows.length > 0) {
|
||||
const header = rows[0].concat(Array(maxCols - rows[0].length).fill(""));
|
||||
mdLines.push("| " + header.join(" | ") + " |");
|
||||
mdLines.push(`| ${header.join(" | ")} |`);
|
||||
}
|
||||
|
||||
// Separator
|
||||
mdLines.push("|" + Array(maxCols).fill(" --- ").join("|") + "|");
|
||||
mdLines.push(`|${Array(maxCols).fill(" --- ").join("|")}|`);
|
||||
|
||||
// Data rows (skip header if we have more rows)
|
||||
const dataRows = rows.length > 1 ? rows.slice(1) : [];
|
||||
for (const row of dataRows) {
|
||||
const padded = row.concat(Array(maxCols - row.length).fill(""));
|
||||
mdLines.push("| " + padded.join(" | ") + " |");
|
||||
mdLines.push(`| ${padded.join(" | ")} |`);
|
||||
}
|
||||
|
||||
// Replace table with markdown
|
||||
|
||||
@@ -60,7 +60,7 @@ async function getTable(): Promise<Table> {
|
||||
// Check if table exists
|
||||
try {
|
||||
return await db.openTable("spec_vectors");
|
||||
} catch (error) {
|
||||
} catch (_error) {
|
||||
console.error("❌ Table 'spec_vectors' not found in database");
|
||||
console.log("\nRun 'bun run ingest' first to populate the database.");
|
||||
process.exit(1);
|
||||
@@ -97,7 +97,7 @@ program
|
||||
.option("-l, --limit <number>", "Number of results to show", "5")
|
||||
.action(async (query: string, options: { limit: string }) => {
|
||||
const table = await getTable();
|
||||
await vectorSearch(table, query, parseInt(options.limit));
|
||||
await vectorSearch(table, query, parseInt(options.limit, 10));
|
||||
});
|
||||
|
||||
program
|
||||
@@ -114,7 +114,7 @@ program
|
||||
.option("-n, --count <number>", "Number of samples to show", "3")
|
||||
.action(async (options: { count: string }) => {
|
||||
const table = await getTable();
|
||||
await showSamples(table, parseInt(options.count));
|
||||
await showSamples(table, parseInt(options.count, 10));
|
||||
});
|
||||
|
||||
program
|
||||
@@ -123,7 +123,7 @@ program
|
||||
.option("-m, --min <number>", "Minimum size in characters", "5000")
|
||||
.action(async (options: { min: string }) => {
|
||||
const table = await getTable();
|
||||
await showLargeDocs(table, parseInt(options.min));
|
||||
await showLargeDocs(table, parseInt(options.min, 10));
|
||||
});
|
||||
|
||||
async function showSummary(table: Table) {
|
||||
@@ -223,7 +223,7 @@ async function listSections(table: Table) {
|
||||
|
||||
for (const [id, info] of sorted) {
|
||||
const title =
|
||||
info.title.length > 50 ? info.title.slice(0, 47) + "..." : info.title;
|
||||
info.title.length > 50 ? `${info.title.slice(0, 47)}...` : info.title;
|
||||
console.log(
|
||||
`${id.padEnd(30)} | ${title.padEnd(50)} | ${info.chunks.toString().padStart(3)}`,
|
||||
);
|
||||
@@ -365,7 +365,7 @@ function printTreeNode(
|
||||
const connector = isLast ? "└── " : "├── ";
|
||||
const title =
|
||||
node.sectiontitle.length > 50
|
||||
? node.sectiontitle.slice(0, 47) + "..."
|
||||
? `${node.sectiontitle.slice(0, 47)}...`
|
||||
: node.sectiontitle;
|
||||
console.log(`${prefix}${connector}${node.sectionid}`);
|
||||
console.log(`${prefix}${isLast ? " " : "│ "} ${title}`);
|
||||
|
||||
Reference in New Issue
Block a user