claude-voice 1.3.20 → 1.3.22
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/package.json +1 -1
- package/scripts/postinstall.js +20 -1
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -147,10 +147,16 @@ async function downloadAndExtractFallback(url, destDir, expectedFolder, label) {
|
|
|
147
147
|
async function downloadFile(url, destPath, label, retries = 3) {
|
|
148
148
|
return new Promise((resolve, reject) => {
|
|
149
149
|
const makeRequest = (requestUrl, attempt = 1) => {
|
|
150
|
+
const parsedUrl = new URL(requestUrl);
|
|
150
151
|
https.get(requestUrl, (response) => {
|
|
151
152
|
// Handle redirects (301, 302, 307, 308)
|
|
152
153
|
if ([301, 302, 307, 308].includes(response.statusCode)) {
|
|
153
|
-
|
|
154
|
+
let redirectUrl = response.headers.location;
|
|
155
|
+
// Handle relative redirects
|
|
156
|
+
if (redirectUrl.startsWith('/')) {
|
|
157
|
+
redirectUrl = `${parsedUrl.protocol}//${parsedUrl.host}${redirectUrl}`;
|
|
158
|
+
}
|
|
159
|
+
makeRequest(redirectUrl, attempt);
|
|
154
160
|
return;
|
|
155
161
|
}
|
|
156
162
|
|
|
@@ -376,6 +382,19 @@ async function runSetup() {
|
|
|
376
382
|
console.log(` Model: Whisper Base (142MB) - better accuracy`);
|
|
377
383
|
await downloadAndExtract(modelUrl, MODELS_DIR, modelFolder, modelId);
|
|
378
384
|
console.log(` [✓] Model installed: ${modelId}`);
|
|
385
|
+
|
|
386
|
+
// Update config to use whisper-base
|
|
387
|
+
try {
|
|
388
|
+
const configPath = path.join(CONFIG_DIR, 'config.json');
|
|
389
|
+
if (fs.existsSync(configPath)) {
|
|
390
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
391
|
+
if (config.stt && config.stt.sherpaOnnx) {
|
|
392
|
+
config.stt.sherpaOnnx.model = 'whisper-base';
|
|
393
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
394
|
+
console.log(` [✓] Config updated to use whisper-base`);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
} catch {}
|
|
379
398
|
}
|
|
380
399
|
} catch (err) {
|
|
381
400
|
console.log(' [!] Could not download STT model:', err.message);
|