From a9648991a24a0e0229d3f06f505cdd59a70fb02c Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 13 Jun 2024 13:46:35 +0200 Subject: [PATCH] chore(transcription): setup verbosity based on NODE_ENV value --- .../src/whisper/transcriber/ctranslate2-transcriber.ts | 4 +--- .../src/whisper/transcriber/openai-transcriber.ts | 4 +--- .../src/whisper/transcriber/timestamped-transcriber.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/transcription/src/whisper/transcriber/ctranslate2-transcriber.ts b/packages/transcription/src/whisper/transcriber/ctranslate2-transcriber.ts index 29801a0d3a63..01b9739a3355 100644 --- a/packages/transcription/src/whisper/transcriber/ctranslate2-transcriber.ts +++ b/packages/transcription/src/whisper/transcriber/ctranslate2-transcriber.ts @@ -16,9 +16,7 @@ export class Ctranslate2Transcriber extends OpenaiTranscriber { }: WhisperTranscribeArgs): Promise { this.assertLanguageDetectionAvailable(language) - // Shall we run the command with `{ shell: true }` to get the same error as in sh ? - // ex: ENOENT => Command not found - const $$ = $({ verbose: true }) + const $$ = $({ verbose: process.env.NODE_ENV !== 'production' }) if (model.path) { assert(await lstat(model.path).then(stats => stats.isDirectory()), 'Model path must be a path to a directory.') diff --git a/packages/transcription/src/whisper/transcriber/openai-transcriber.ts b/packages/transcription/src/whisper/transcriber/openai-transcriber.ts index 961700fcb710..5d9a7ce856a8 100644 --- a/packages/transcription/src/whisper/transcriber/openai-transcriber.ts +++ b/packages/transcription/src/whisper/transcriber/openai-transcriber.ts @@ -20,9 +20,7 @@ export class OpenaiTranscriber extends AbstractTranscriber { }: WhisperTranscribeArgs): Promise { this.assertLanguageDetectionAvailable(language) - // Shall we run the command with `{ shell: true }` to get the same error as in sh ? - // ex: ENOENT => Command not found - const $$ = $({ verbose: true }) + const $$ = $({ verbose: process.env.NODE_ENV !== 'production' }) const languageArgs = language ? [ '--language', language ] : [] this.createRun(runId) diff --git a/packages/transcription/src/whisper/transcriber/timestamped-transcriber.ts b/packages/transcription/src/whisper/transcriber/timestamped-transcriber.ts index d6d376d7b32b..fcdd33eb1a07 100644 --- a/packages/transcription/src/whisper/transcriber/timestamped-transcriber.ts +++ b/packages/transcription/src/whisper/transcriber/timestamped-transcriber.ts @@ -18,7 +18,7 @@ export class WhisperTimestampedTranscriber extends OpenaiTranscriber { }: WhisperTranscribeArgs): Promise { this.assertLanguageDetectionAvailable(language) - const $$ = $({ verbose: true }) + const $$ = $({ verbose: process.env.NODE_ENV !== 'production' }) const languageArgs = language ? [ '--language', language ] : [] this.createRun(runId)