agentgui 1.0.449 → 1.0.451
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/static/js/voice.js +3 -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 });
|
package/static/js/voice.js
CHANGED
|
@@ -578,9 +578,9 @@
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
function stripHtml(text) {
|
|
582
|
-
return text.replace(/<[^>]*>/g, '').replace(/[ \t]+/g, ' ').trim();
|
|
583
|
-
}
|
|
581
|
+
function stripHtml(text) {
|
|
582
|
+
return text.replace(/<[^>]*>/g, '').replace(/[ \t]+/g, ' ').trim();
|
|
583
|
+
}
|
|
584
584
|
|
|
585
585
|
function addVoiceBlock(text, isUser) {
|
|
586
586
|
var container = document.getElementById('voiceMessages');
|
|
@@ -742,8 +742,6 @@
|
|
|
742
742
|
}
|
|
743
743
|
} else if (block.type === 'result') {
|
|
744
744
|
_voiceBreakNext = true;
|
|
745
|
-
} else {
|
|
746
|
-
_voiceBreakNext = true;
|
|
747
745
|
}
|
|
748
746
|
}
|
|
749
747
|
|
|
@@ -780,8 +778,6 @@
|
|
|
780
778
|
hasContent = true;
|
|
781
779
|
} else if (block.type === 'result') {
|
|
782
780
|
_voiceBreakNext = true;
|
|
783
|
-
} else {
|
|
784
|
-
_voiceBreakNext = true;
|
|
785
781
|
}
|
|
786
782
|
});
|
|
787
783
|
if (!hasContent) showVoiceEmpty(container);
|