rampup 0.1.7 → 0.1.8
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/index.js +10 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -850,6 +850,7 @@ async function runRealtimeVoiceMode(authToken, context, projectPath, usage, usag
|
|
|
850
850
|
let audioChunks = [];
|
|
851
851
|
let transcriptChunks = [];
|
|
852
852
|
let isListening = false;
|
|
853
|
+
let isPlayingAudio = false; // Mute mic while playing to prevent feedback loop
|
|
853
854
|
let sessionDurationSeconds = 0;
|
|
854
855
|
const sessionTimer = setInterval(() => sessionDurationSeconds++, 1000);
|
|
855
856
|
|
|
@@ -916,6 +917,11 @@ Be friendly, practical, and reference specific files when relevant. If asked abo
|
|
|
916
917
|
}
|
|
917
918
|
break;
|
|
918
919
|
|
|
920
|
+
case 'response.created':
|
|
921
|
+
// AI is starting to respond - mute mic to prevent feedback
|
|
922
|
+
isPlayingAudio = true;
|
|
923
|
+
break;
|
|
924
|
+
|
|
919
925
|
case 'response.audio.delta':
|
|
920
926
|
// Collect audio chunks
|
|
921
927
|
if (event.delta) {
|
|
@@ -945,6 +951,8 @@ Be friendly, practical, and reference specific files when relevant. If asked abo
|
|
|
945
951
|
audioChunks = [];
|
|
946
952
|
transcriptChunks = [];
|
|
947
953
|
}
|
|
954
|
+
// Resume listening after audio finishes
|
|
955
|
+
isPlayingAudio = false;
|
|
948
956
|
break;
|
|
949
957
|
|
|
950
958
|
case 'response.done':
|
|
@@ -987,8 +995,8 @@ Be friendly, practical, and reference specific files when relevant. If asked abo
|
|
|
987
995
|
micInputStream = micInstance.getAudioStream();
|
|
988
996
|
|
|
989
997
|
micInputStream.on('data', (chunk) => {
|
|
990
|
-
|
|
991
|
-
|
|
998
|
+
// Don't send audio while AI is speaking (prevents feedback loop)
|
|
999
|
+
if (isConnected && ws.readyState === WebSocket.OPEN && !isPlayingAudio) {
|
|
992
1000
|
ws.send(JSON.stringify({
|
|
993
1001
|
type: 'input_audio_buffer.append',
|
|
994
1002
|
audio: chunk.toString('base64'),
|