From 97e4804eb31e1acbdad0bf00e2f08c699151585c Mon Sep 17 00:00:00 2001 From: an-lee Date: Tue, 23 Jan 2024 21:25:31 +0800 Subject: [PATCH] fix no whisper models dir (#197) --- enjoy/src/main/whisper.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enjoy/src/main/whisper.ts b/enjoy/src/main/whisper.ts index 683f7548..afa43414 100644 --- a/enjoy/src/main/whisper.ts +++ b/enjoy/src/main/whisper.ts @@ -14,8 +14,7 @@ class Whipser { public config: WhisperConfigType; constructor(config?: WhisperConfigType) { - this.config = config; - this.initialize(); + this.config = config || settings.whisperConfig(); } currentModel() { @@ -26,6 +25,7 @@ class Whipser { async initialize() { const dir = path.join(settings.libraryPath(), "whisper", "models"); + fs.ensureDirSync(dir); const files = fs.readdirSync(dir); const models = []; for (const file of files) { @@ -298,7 +298,7 @@ class Whipser { }); }); - ipcMain.handle("whisper-check", async (event) => { + ipcMain.handle("whisper-check", async (_event) => { return await this.check(); });