agentgui 1.0.521 → 1.0.522
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/static/js/client.js +33 -14
package/package.json
CHANGED
package/static/js/client.js
CHANGED
|
@@ -494,21 +494,19 @@ class AgentGUIClient {
|
|
|
494
494
|
|
|
495
495
|
let isRecording = false;
|
|
496
496
|
|
|
497
|
-
|
|
498
|
-
e.preventDefault();
|
|
497
|
+
const handleStartRecording = async () => {
|
|
499
498
|
if (isRecording) return;
|
|
500
|
-
isRecording = true;
|
|
501
499
|
chatMicBtn.classList.add('recording');
|
|
502
500
|
const result = await window.STTHandler.startRecording();
|
|
503
|
-
if (
|
|
504
|
-
isRecording =
|
|
501
|
+
if (result.success) {
|
|
502
|
+
isRecording = true;
|
|
503
|
+
} else {
|
|
505
504
|
chatMicBtn.classList.remove('recording');
|
|
506
505
|
alert('Microphone access denied: ' + result.error);
|
|
507
506
|
}
|
|
508
|
-
}
|
|
507
|
+
};
|
|
509
508
|
|
|
510
|
-
|
|
511
|
-
e.preventDefault();
|
|
509
|
+
const handleStopRecording = async () => {
|
|
512
510
|
if (!isRecording) return;
|
|
513
511
|
isRecording = false;
|
|
514
512
|
chatMicBtn.classList.remove('recording');
|
|
@@ -520,16 +518,37 @@ class AgentGUIClient {
|
|
|
520
518
|
} else {
|
|
521
519
|
alert('Transcription failed: ' + result.error);
|
|
522
520
|
}
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
chatMicBtn.addEventListener('mousedown', async (e) => {
|
|
524
|
+
e.preventDefault();
|
|
525
|
+
await handleStartRecording();
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
chatMicBtn.addEventListener('mouseup', async (e) => {
|
|
529
|
+
e.preventDefault();
|
|
530
|
+
await handleStopRecording();
|
|
523
531
|
});
|
|
524
532
|
|
|
525
533
|
chatMicBtn.addEventListener('mouseleave', async (e) => {
|
|
526
534
|
if (isRecording) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
535
|
+
await handleStopRecording();
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
chatMicBtn.addEventListener('touchstart', async (e) => {
|
|
540
|
+
e.preventDefault();
|
|
541
|
+
await handleStartRecording();
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
chatMicBtn.addEventListener('touchend', async (e) => {
|
|
545
|
+
e.preventDefault();
|
|
546
|
+
await handleStopRecording();
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
chatMicBtn.addEventListener('touchcancel', async (e) => {
|
|
550
|
+
if (isRecording) {
|
|
551
|
+
await handleStopRecording();
|
|
533
552
|
}
|
|
534
553
|
});
|
|
535
554
|
}
|