Skip to content

Commit c30eefe

Browse files
authored
Merge pull request #98 from SimonRosengren/fix/allow-for-more-than-one-auto-download-model
Only check if provided autoDownloadModelName already exist
2 parents 7ebd954 + a7c7a8f commit c30eefe

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)