|
|
|
@@ -27,7 +27,6 @@ export class Ai {
|
|
|
|
this.llm = new LLM(this, options);
|
|
|
|
this.llm = new LLM(this, options);
|
|
|
|
if(this.options.whisper?.binary) {
|
|
|
|
if(this.options.whisper?.binary) {
|
|
|
|
this.whisperModel = this.options.whisper?.model.endsWith('.bin') ? this.options.whisper?.model : this.options.whisper?.model + '.bin';
|
|
|
|
this.whisperModel = this.options.whisper?.model.endsWith('.bin') ? this.options.whisper?.model : this.options.whisper?.model + '.bin';
|
|
|
|
console.log('constructor: ' + this.options.whisper.model + ' -> ' + this.whisperModel);
|
|
|
|
|
|
|
|
this.downloadAsrModel();
|
|
|
|
this.downloadAsrModel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -67,11 +66,7 @@ export class Ai {
|
|
|
|
if(!this.options.whisper?.binary) throw new Error('Whisper not configured');
|
|
|
|
if(!this.options.whisper?.binary) throw new Error('Whisper not configured');
|
|
|
|
if(!model.endsWith('.bin')) model += '.bin';
|
|
|
|
if(!model.endsWith('.bin')) model += '.bin';
|
|
|
|
const p = Path.join(this.options.whisper.path, model);
|
|
|
|
const p = Path.join(this.options.whisper.path, model);
|
|
|
|
console.log('Download: ' + p);
|
|
|
|
if(await fs.stat(p).then(() => true).catch(() => false)) return p;
|
|
|
|
if(await fs.stat(p).then(() => true).catch(() => false)) {
|
|
|
|
|
|
|
|
console.log('Exists!');
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!!this.downloads[model]) return this.downloads[model];
|
|
|
|
if(!!this.downloads[model]) return this.downloads[model];
|
|
|
|
this.downloads[model] = fetch(`https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${model}`)
|
|
|
|
this.downloads[model] = fetch(`https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${model}`)
|
|
|
|
.then(resp => resp.arrayBuffer())
|
|
|
|
.then(resp => resp.arrayBuffer())
|
|
|
|
|