37 lines
984 B
TypeScript
37 lines
984 B
TypeScript
import { join } from "node:path"
|
|
import { parseArgs } from "node:util"
|
|
import { writeManualsQdrantArtifacts } from "@/lib/manuals-qdrant-corpus"
|
|
|
|
const { values } = parseArgs({
|
|
args: process.argv.slice(2),
|
|
options: {
|
|
"output-dir": {
|
|
type: "string",
|
|
},
|
|
},
|
|
})
|
|
|
|
const defaultOutputDir = join(process.cwd(), "output", "manuals-qdrant")
|
|
|
|
async function main() {
|
|
const result = await writeManualsQdrantArtifacts({
|
|
outputDir: values["output-dir"] || defaultOutputDir,
|
|
})
|
|
|
|
const summary = {
|
|
outputDir: result.outputDir,
|
|
manuals: result.corpus.manuals.length,
|
|
chunks: result.corpus.chunks.length,
|
|
highConfidenceChunks: result.corpus.stats.highConfidenceChunks,
|
|
fallbackChunks: result.corpus.stats.fallbackChunks,
|
|
excludedChunks: result.corpus.stats.excludedChunks,
|
|
evaluation: result.evaluation.summary,
|
|
}
|
|
|
|
console.log(JSON.stringify(summary, null, 2))
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error)
|
|
process.exitCode = 1
|
|
})
|