Add node-addon-api for VAD (#864)

This commit is contained in:
Fangjun Kuang
2024-05-11 20:58:23 +08:00
committed by GitHub
parent 677bc1da3e
commit eee5d8a15c
15 changed files with 914 additions and 10 deletions

View File

@@ -125,8 +125,13 @@ static SherpaOnnxOnlineModelConfig GetOnlineModelConfig(Napi::Object obj) {
config.provider = p;
}
if (o.Has("debug") && o.Get("debug").IsNumber()) {
config.debug = o.Get("debug").As<Napi::Number>().Int32Value();
if (o.Has("debug") &&
(o.Get("debug").IsNumber() || o.Get("debug").IsBoolean())) {
if (o.Get("debug").IsBoolean()) {
config.debug = o.Get("debug").As<Napi::Boolean>().Value();
} else {
config.debug = o.Get("debug").As<Napi::Number>().Int32Value();
}
}
if (o.Has("modelType") && o.Get("modelType").IsString()) {