Skip to content

Commit b0b0f80

Browse files
author
linxiaodong
committed
feat: support prompt api
1 parent e737515 commit b0b0f80

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/addon.node/addon.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
367367
int32_t audio_ctx = whisper_params.Get("audio_ctx").As<Napi::Number>();
368368
bool comma_in_time = whisper_params.Get("comma_in_time").As<Napi::Boolean>();
369369
int32_t max_len = whisper_params.Get("max_len").As<Napi::Number>();
370+
371+
// support prompt
372+
std::string prompt = "";
373+
if (whisper_params.Has("prompt") && whisper_params.Get("prompt").IsString()) {
374+
prompt = whisper_params.Get("prompt").As<Napi::String>();
375+
}
376+
370377
// Add support for print_progress
371378
bool print_progress = false;
372379
if (whisper_params.Has("print_progress")) {
@@ -401,6 +408,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
401408
params.comma_in_time = comma_in_time;
402409
params.max_len = max_len;
403410
params.print_progress = print_progress;
411+
params.prompt = prompt;
404412

405413
Napi::Function callback = info[1].As<Napi::Function>();
406414
// Create a new Worker class with progress callback support

0 commit comments

Comments
 (0)