mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-05-30 14:38:53 +02:00
addon.node : support max_context api for addon.node (#3025)
* feat: support max content * feat: show api in test file --------- Co-authored-by: linxiaodong <calm.lin@wukongsch.com>
This commit is contained in:
parent
549db9376f
commit
e853620270
@ -19,6 +19,12 @@ const whisperParamsMock = {
|
|||||||
no_timestamps: false,
|
no_timestamps: false,
|
||||||
audio_ctx: 0,
|
audio_ctx: 0,
|
||||||
max_len: 0,
|
max_len: 0,
|
||||||
|
prompt: "",
|
||||||
|
print_progress: false,
|
||||||
|
progress_callback: (progress) => {
|
||||||
|
console.log(`Progress: ${progress}`);
|
||||||
|
},
|
||||||
|
max_context: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
describe("Run whisper.node", () => {
|
describe("Run whisper.node", () => {
|
||||||
|
@ -368,6 +368,12 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
|
|||||||
bool comma_in_time = whisper_params.Get("comma_in_time").As<Napi::Boolean>();
|
bool comma_in_time = whisper_params.Get("comma_in_time").As<Napi::Boolean>();
|
||||||
int32_t max_len = whisper_params.Get("max_len").As<Napi::Number>();
|
int32_t max_len = whisper_params.Get("max_len").As<Napi::Number>();
|
||||||
|
|
||||||
|
// Add support for max_context
|
||||||
|
int32_t max_context = -1;
|
||||||
|
if (whisper_params.Has("max_context") && whisper_params.Get("max_context").IsNumber()) {
|
||||||
|
max_context = whisper_params.Get("max_context").As<Napi::Number>();
|
||||||
|
}
|
||||||
|
|
||||||
// support prompt
|
// support prompt
|
||||||
std::string prompt = "";
|
std::string prompt = "";
|
||||||
if (whisper_params.Has("prompt") && whisper_params.Get("prompt").IsString()) {
|
if (whisper_params.Has("prompt") && whisper_params.Get("prompt").IsString()) {
|
||||||
@ -407,6 +413,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
|
|||||||
params.pcmf32 = pcmf32_vec;
|
params.pcmf32 = pcmf32_vec;
|
||||||
params.comma_in_time = comma_in_time;
|
params.comma_in_time = comma_in_time;
|
||||||
params.max_len = max_len;
|
params.max_len = max_len;
|
||||||
|
params.max_context = max_context;
|
||||||
params.print_progress = print_progress;
|
params.print_progress = print_progress;
|
||||||
params.prompt = prompt;
|
params.prompt = prompt;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user