openwakeword-js 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +1 -1
- package/package.json +2 -2
- package/scripts/download_models.js +20 -14
package/index.html
CHANGED
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
class="h-44 overflow-y-auto rounded-xl bg-[#030406] p-4 font-mono text-[10px] text-slate-600 border border-white/5 custom-scrollbar leading-relaxed">
|
|
287
287
|
<div
|
|
288
288
|
class="opacity-40 animate-pulse font-bold text-blue-900 border border-blue-900/40 p-1 inline-block rounded mb-2">
|
|
289
|
-
OPENWAKEWORD-JS V0.1.
|
|
289
|
+
OPENWAKEWORD-JS V0.1.15 READY</div>
|
|
290
290
|
</div>
|
|
291
291
|
</div>
|
|
292
292
|
</details>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openwakeword-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Port of openWakeWord to JavaScript/TypeScript using ONNX Runtime",
|
|
5
5
|
"bin": {
|
|
6
6
|
"openwakeword-js-setup": "scripts/download_models.js"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"LICENSE"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"onnxruntime-web": "
|
|
31
|
+
"onnxruntime-web": "1.24.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^5.0.0",
|
|
@@ -18,19 +18,23 @@ const MODELS = {
|
|
|
18
18
|
|
|
19
19
|
async function downloadFile(url, dest) {
|
|
20
20
|
return new Promise((resolve, reject) => {
|
|
21
|
-
const file = fs.createWriteStream(dest);
|
|
22
21
|
https.get(url, (response) => {
|
|
23
22
|
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
24
23
|
downloadFile(response.headers.location, dest).then(resolve).catch(reject);
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
26
|
+
if (response.statusCode !== 200) {
|
|
27
|
+
reject(new Error(`Failed to download: ${response.statusCode} for ${url}`));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const file = fs.createWriteStream(dest);
|
|
27
31
|
response.pipe(file);
|
|
28
32
|
file.on('finish', () => {
|
|
29
33
|
file.close();
|
|
30
34
|
resolve();
|
|
31
35
|
});
|
|
32
36
|
}).on('error', (err) => {
|
|
33
|
-
fs.
|
|
37
|
+
if (fs.existsSync(dest)) fs.unlinkSync(dest);
|
|
34
38
|
reject(err);
|
|
35
39
|
});
|
|
36
40
|
});
|
|
@@ -51,11 +55,11 @@ async function main() {
|
|
|
51
55
|
console.log(`Created directory: ${MODELS_DIR}`);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
console.log('Downloading
|
|
58
|
+
console.log('Downloading neural model binaries...');
|
|
55
59
|
for (const [name, url] of Object.entries(MODELS)) {
|
|
56
60
|
const dest = path.join(MODELS_DIR, name);
|
|
57
|
-
if (fs.existsSync(dest)) {
|
|
58
|
-
console.log(`- ${name} already exists, skipping.`);
|
|
61
|
+
if (fs.existsSync(dest) && fs.statSync(dest).size > 1000) {
|
|
62
|
+
console.log(`- ${name} already exists and validated, skipping.`);
|
|
59
63
|
continue;
|
|
60
64
|
}
|
|
61
65
|
process.stdout.write(`- Downloading ${name}... `);
|
|
@@ -66,22 +70,24 @@ async function main() {
|
|
|
66
70
|
console.log(`Failed: ${err.message}`);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
|
-
console.log('\
|
|
73
|
+
console.log('\nAI Model deployment complete.');
|
|
70
74
|
|
|
71
|
-
console.log('\
|
|
75
|
+
console.log('\nDeploying ONNX Runtime WebAssembly environment...');
|
|
72
76
|
const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'onnxruntime-web', 'dist');
|
|
73
77
|
|
|
74
78
|
if (fs.existsSync(nodeModulesPath)) {
|
|
75
|
-
// Copy
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
// Copy EVERYTHING starting with ort-wasm to ensure all loaders/workers are present
|
|
80
|
+
const runtimeFiles = fs.readdirSync(nodeModulesPath).filter(f =>
|
|
81
|
+
f.startsWith('ort-wasm') && (f.endsWith('.wasm') || f.endsWith('.mjs') || f.endsWith('.js'))
|
|
82
|
+
);
|
|
83
|
+
for (const file of runtimeFiles) {
|
|
84
|
+
copyIfExists(path.join(nodeModulesPath, file), path.join(MODELS_DIR, file), 'RUNTIME');
|
|
79
85
|
}
|
|
80
86
|
} else {
|
|
81
|
-
console.log('Warning: onnxruntime-web not found
|
|
87
|
+
console.log('Warning: onnxruntime-web not found in node_modules. Standard inference may fail.');
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
console.log('\nDeploying AI Listening Interface...');
|
|
90
|
+
console.log('\nDeploying optimized AI Listening Interface...');
|
|
85
91
|
const exampleHtml = path.join(packageRoot, 'index.html');
|
|
86
92
|
const destHtml = path.join(process.cwd(), 'index.html');
|
|
87
93
|
copyIfExists(exampleHtml, destHtml, 'UI');
|
|
@@ -91,7 +97,7 @@ async function main() {
|
|
|
91
97
|
copyIfExists(libSrc, libDest, 'Library');
|
|
92
98
|
|
|
93
99
|
console.log('\n----------------------------------------------------');
|
|
94
|
-
console.log('SETUP COMPLETE');
|
|
100
|
+
console.log('SETUP COMPLETE (v0.1.15)');
|
|
95
101
|
console.log('----------------------------------------------------');
|
|
96
102
|
console.log('Your precision AI wake word interface is ready.');
|
|
97
103
|
console.log('\nTo start the demo:');
|