Skip to content

Commit d5432fb

Browse files
ChetanXprogithub-actions[bot]
authored andcommitted
style: format code with prettier
1 parent b2d237b commit d5432fb

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/WhisperHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const constructCommand = (filePath: string, args: IOptions): string => {
2727
}
2828

2929
const modelName = MODEL_OBJECT[args.modelName as keyof typeof MODEL_OBJECT]
30-
let command = `./main ${constructOptionsFlags(args)} -l ${args.whisperOptions?.language ? args.whisperOptions?.language : 'auto'} -m "./models/${modelName}" -f "${filePath}"`
30+
let command = `./main ${constructOptionsFlags(args)} -l ${args.whisperOptions?.language ? args.whisperOptions?.language : 'auto'} -m "./models/${modelName}" -f "${filePath}"`
3131

3232
return command
3333
}

src/autoDownloadModel.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,22 @@ export default async function autoDownloadModel(
4747
shell.cd('../')
4848

4949
let compileCommand
50-
if (process.platform === 'win32') {
51-
// Try mingw32-make first
52-
if (shell.which('mingw32-make')) {
53-
compileCommand = withCuda ? 'WHISPER_CUDA=1 mingw32-make -j' : 'mingw32-make -j'
54-
} else if (shell.which('make')) {
55-
compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
56-
} else {
57-
throw new Error('[Nodejs-whisper] Neither mingw32-make nor make found. Please install MinGW-w64 or MSYS2.')
58-
}
59-
} else {
60-
compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
61-
}
62-
63-
const compileResult = shell.exec(compileCommand)
50+
if (process.platform === 'win32') {
51+
// Try mingw32-make first
52+
if (shell.which('mingw32-make')) {
53+
compileCommand = withCuda ? 'WHISPER_CUDA=1 mingw32-make -j' : 'mingw32-make -j'
54+
} else if (shell.which('make')) {
55+
compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
56+
} else {
57+
throw new Error(
58+
'[Nodejs-whisper] Neither mingw32-make nor make found. Please install MinGW-w64 or MSYS2.'
59+
)
60+
}
61+
} else {
62+
compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
63+
}
6464

65+
const compileResult = shell.exec(compileCommand)
6566

6667
if (compileResult.code !== 0) {
6768
throw new Error(`[Nodejs-whisper] Failed to compile model: ${compileResult.stderr}`)

src/downloadModel.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const askIfUserWantToUseCuda = async (logger = console) => {
4646
}
4747
}
4848

49-
async function downloadModel(logger = console) {
49+
async function downloadModel(logger = console) {
5050
try {
5151
shell.cd(path.join(__dirname, '..', './cpp/whisper.cpp/models'))
5252

@@ -60,10 +60,10 @@ const askIfUserWantToUseCuda = async (logger = console) => {
6060
})
6161

6262
if (anyModelExist.length > 0) {
63-
console.log('\n[Nodejs-whisper] Currently installed models:')
64-
anyModelExist.forEach(model => console.log(`- ${model}`))
65-
console.log('\n[Nodejs-whisper] You can install additional models from the list below.\n')
66-
}
63+
console.log('\n[Nodejs-whisper] Currently installed models:')
64+
anyModelExist.forEach(model => console.log(`- ${model}`))
65+
console.log('\n[Nodejs-whisper] You can install additional models from the list below.\n')
66+
}
6767

6868
logger.log(`
6969
| Model | Disk | RAM |
@@ -115,7 +115,6 @@ const askIfUserWantToUseCuda = async (logger = console) => {
115115
}
116116
// run on npx nodejs-whisper download
117117
downloadModel().catch(error => {
118-
console.error('Failed to download:', error)
119-
process.exit(1)
118+
console.error('Failed to download:', error)
119+
process.exit(1)
120120
})
121-

0 commit comments

Comments
 (0)