Skip to content

Commit a7c7a8f

Browse files
Only check if provided autoDownloadModelName already exist
1 parent 5b1404a commit a7c7a8f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/autoDownloadModel.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ export default async function autoDownloadModel(
2121
try {
2222
const modelDirectory = path.join(__dirname, '..', 'cpp', 'whisper.cpp', 'models')
2323
shell.cd(modelDirectory)
24+
const modelAlreadyExist = fs.existsSync(path.join(modelDirectory, autoDownloadModelName));
2425

25-
const existingModels = MODELS.filter(model => fs.existsSync(path.join(modelDirectory, model)))
26-
27-
if (existingModels.length > 0) {
26+
if (modelAlreadyExist) {
2827
if (verbose) {
29-
console.log('[Nodejs-whisper] Models already exist. Skipping download.')
28+
console.log(`[Nodejs-whisper] ${autoDownloadModel} already exist. Skipping download.`)
3029
}
3130
return 'Models already exist. Skipping download.'
3231
}

0 commit comments

Comments
 (0)