Pārlūkot izejas kodu

stop streaming play after get input audio.

lloydzhou 1 gadu atpakaļ
vecāks
revīzija
283caba8ce
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      app/components/realtime-chat/realtime-chat.tsx

+ 2 - 1
app/components/realtime-chat/realtime-chat.tsx

@@ -202,7 +202,6 @@ export function RealtimeChat({
   };
 
   const handleInputAudio = async (item: RTInputAudioItem) => {
-    audioHandlerRef.current?.stopStreamingPlayback();
     await item.waitForCompletion();
     if (item.transcription) {
       const userMessage = createMessage({
@@ -226,6 +225,8 @@ export function RealtimeChat({
         });
       });
     }
+    // stop streaming play after get input audio.
+    audioHandlerRef.current?.stopStreamingPlayback();
   };
 
   const toggleRecording = async () => {