From af4b09173c760a68d94bc69f3ea2822e3157105f Mon Sep 17 00:00:00 2001 From: ztimson Date: Sat, 13 Dec 2025 22:31:54 -0500 Subject: [PATCH] ASR debugging --- package.json | 2 +- src/ai.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 075cd24..80d6a55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/ai-utils", - "version": "0.1.8", + "version": "0.1.9", "description": "AI Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/ai.ts b/src/ai.ts index c1ef133..074ab5b 100644 --- a/src/ai.ts +++ b/src/ai.ts @@ -43,11 +43,13 @@ export class Ai { */ async asr(path: string, model?: WhisperModel): Promise { if(!this.options.whisper?.binary) throw new Error('Whisper not configured'); - await this.downloadAsrModel(model); + const m = await this.downloadAsrModel(model); const name = Math.random().toString(36).substring(2, 10) + '-' + path.split('/').pop() + '.txt'; const output = Path.join(this.options.whisper.temp || '/tmp', name); - console.log(`rm -f ${output} && ${this.options.whisper.binary} -nt -np -m ${model ? Path.join(this.options.whisper.path, model) : this.whisperModel} -f ${path} -otxt -of ${output}`); - await $`rm -f ${output} && ${this.options.whisper.binary} -nt -np -m ${model ? Path.join(this.options.whisper.path, model) : this.whisperModel} -f ${path} -otxt -of ${output}`; + console.log('model:', this.options.whisper?.model); + console.log(this.whisperModel); + console.log(`rm -f ${output} && ${this.options.whisper.binary} -nt -np -m ${m} -f ${path} -otxt -of ${output}`); + await $`rm -f ${output} && ${this.options.whisper.binary} -nt -np -m ${m} -f ${path} -otxt -of ${output}`; return fs.readFile(output, 'utf-8').then(text => text?.trim() || null) .finally(() => fs.rm(output, {force: true}).catch(() => {})); }