myagent-ai 1.16.0 → 1.16.1
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/web/ui/chat/chat_main.js +18 -1
package/package.json
CHANGED
package/web/ui/chat/chat_main.js
CHANGED
|
@@ -4520,7 +4520,24 @@ var VoiceInput = {
|
|
|
4520
4520
|
this._processAudio();
|
|
4521
4521
|
},
|
|
4522
4522
|
|
|
4523
|
-
/** 清理音频流
|
|
4523
|
+
/** 清理音频流 */
|
|
4524
|
+
_cleanupStream: function() {
|
|
4525
|
+
// 断开 ScriptProcessor
|
|
4526
|
+
if (this._scriptProcessor) {
|
|
4527
|
+
try { this._scriptProcessor.disconnect(); } catch(e) {}
|
|
4528
|
+
this._scriptProcessor = null;
|
|
4529
|
+
}
|
|
4530
|
+
// 关闭 AudioContext
|
|
4531
|
+
if (this._audioContext && this._audioContext.state !== 'closed') {
|
|
4532
|
+
try { this._audioContext.close(); } catch(e) {}
|
|
4533
|
+
this._audioContext = null;
|
|
4534
|
+
}
|
|
4535
|
+
// 停止麦克风流
|
|
4536
|
+
if (this._audioStream) {
|
|
4537
|
+
this._audioStream.getTracks().forEach(function(t) { t.stop(); });
|
|
4538
|
+
this._audioStream = null;
|
|
4539
|
+
}
|
|
4540
|
+
},
|
|
4524
4541
|
|
|
4525
4542
|
/** 将 PCM Float32 样本编码为 WAV Blob(16kHz, 单声道, 16bit) */
|
|
4526
4543
|
_encodeWav: function(samples, sampleRate) {
|