agentgui 1.0.449 → 1.0.450
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/lib/speech.js +1 -1
- package/package.json +1 -1
- package/server.js +9 -7
package/lib/speech.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
const require = createRequire(import.meta.url);
|
|
3
3
|
const speech = require('webtalk/speech');
|
|
4
|
-
export const { transcribe, synthesize, synthesizeStream, getSTT, getStatus, getVoices, preloadTTS, ttsCacheKey, ttsCacheGet, splitSentences } = speech;
|
|
4
|
+
export const { transcribe, synthesize, synthesizeStream, getSTT, getStatus, getVoices, preloadTTS, ttsCacheKey, ttsCacheGet, splitSentences, resetSTTError, clearCorruptedSTTCache } = speech;
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -2486,15 +2486,17 @@ const server = http.createServer(async (req, res) => {
|
|
|
2486
2486
|
let errorMsg = err.message || 'STT failed';
|
|
2487
2487
|
if (errorMsg.includes('VERS_1.21') || errorMsg.includes('onnxruntime')) {
|
|
2488
2488
|
errorMsg = 'STT model load failed: onnxruntime version mismatch. Try: npm install or npm ci';
|
|
2489
|
-
} else if (errorMsg.includes('not valid JSON') || errorMsg.includes('Unexpected token')) {
|
|
2490
|
-
errorMsg = 'STT model load failed: corrupted cache. Clearing... try again.';
|
|
2491
|
-
const modelsDir = path.join(os.homedir(), '.gmgui', 'models');
|
|
2489
|
+
} else if (errorMsg.includes('not valid JSON') || errorMsg.includes('Unexpected token') || errorMsg.includes('corrupted files cleared')) {
|
|
2492
2490
|
try {
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2495
|
-
|
|
2491
|
+
const speech = await getSpeech();
|
|
2492
|
+
const cleared = speech.clearCorruptedSTTCache();
|
|
2493
|
+
speech.resetSTTError();
|
|
2494
|
+
console.log('[STT] Cleared', cleared, 'corrupted files and reset error state');
|
|
2495
|
+
await ensureModelsDownloaded();
|
|
2496
|
+
errorMsg = 'STT cache was corrupted, re-downloaded models. Please try again.';
|
|
2496
2497
|
} catch (e) {
|
|
2497
|
-
console.warn('[STT]
|
|
2498
|
+
console.warn('[STT] Recovery failed:', e.message);
|
|
2499
|
+
errorMsg = 'STT model load failed: corrupted cache. Recovery attempted, try again.';
|
|
2498
2500
|
}
|
|
2499
2501
|
}
|
|
2500
2502
|
broadcastSync({ type: 'stt_progress', status: 'failed', percentComplete: 0, error: errorMsg });
|