billyct commited on
Commit
91b432f
·
unverified ·
1 Parent(s): 9b44911

node : add max_len params in node addon (#2760)

Browse files
examples/addon.node/addon.cpp CHANGED
@@ -330,6 +330,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
330
  bool no_timestamps = whisper_params.Get("no_timestamps").As<Napi::Boolean>();
331
  int32_t audio_ctx = whisper_params.Get("audio_ctx").As<Napi::Number>();
332
  bool comma_in_time = whisper_params.Get("comma_in_time").As<Napi::Boolean>();
 
333
 
334
  Napi::Value pcmf32Value = whisper_params.Get("pcmf32");
335
  std::vector<float> pcmf32_vec;
@@ -352,6 +353,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
352
  params.audio_ctx = audio_ctx;
353
  params.pcmf32 = pcmf32_vec;
354
  params.comma_in_time = comma_in_time;
 
355
 
356
  Napi::Function callback = info[1].As<Napi::Function>();
357
  Worker* worker = new Worker(callback, params);
 
330
  bool no_timestamps = whisper_params.Get("no_timestamps").As<Napi::Boolean>();
331
  int32_t audio_ctx = whisper_params.Get("audio_ctx").As<Napi::Number>();
332
  bool comma_in_time = whisper_params.Get("comma_in_time").As<Napi::Boolean>();
333
+ int32_t max_len = whisper_params.Get("max_len").As<Napi::Number>();
334
 
335
  Napi::Value pcmf32Value = whisper_params.Get("pcmf32");
336
  std::vector<float> pcmf32_vec;
 
353
  params.audio_ctx = audio_ctx;
354
  params.pcmf32 = pcmf32_vec;
355
  params.comma_in_time = comma_in_time;
356
+ params.max_len = max_len;
357
 
358
  Napi::Function callback = info[1].As<Napi::Function>();
359
  Worker* worker = new Worker(callback, params);
examples/addon.node/index.js CHANGED
@@ -18,6 +18,7 @@ const whisperParams = {
18
  translate: true,
19
  no_timestamps: false,
20
  audio_ctx: 0,
 
21
  };
22
 
23
  const arguments = process.argv.slice(2);
 
18
  translate: true,
19
  no_timestamps: false,
20
  audio_ctx: 0,
21
+ max_len: 0,
22
  };
23
 
24
  const arguments = process.argv.slice(2);