@@ -93,23 +93,27 @@ async function generateLiveConversation(
9393
9494 while ( ! done ) {
9595 const message = await waitMessage ( ) ;
96- const sc = message . serverContent ;
96+ const serverContent = message . serverContent ;
9797
98- if ( sc && sc . inputTranscription ) {
99- console . log ( 'Input transcription' , sc . inputTranscription ) ;
98+ if ( serverContent && serverContent . inputTranscription ) {
99+ console . log ( 'Input transcription' , serverContent . inputTranscription ) ;
100100 }
101- if ( sc && sc . outputTranscription ) {
102- console . log ( 'Output transcription' , sc . outputTranscription ) ;
101+ if ( serverContent && serverContent . outputTranscription ) {
102+ console . log ( 'Output transcription' , serverContent . outputTranscription ) ;
103103 }
104- if ( sc && sc . modelTurn && sc . modelTurn . parts ) {
105- for ( const part of sc . modelTurn . parts ) {
104+ if (
105+ serverContent &&
106+ serverContent . modelTurn &&
107+ serverContent . modelTurn . parts
108+ ) {
109+ for ( const part of serverContent . modelTurn . parts ) {
106110 if ( part && part . inlineData && part . inlineData . data ) {
107111 const audioData = Buffer . from ( part . inlineData . data , 'base64' ) ;
108112 audioFrames . push ( audioData ) ;
109113 }
110114 }
111115 }
112- if ( sc && sc . turnComplete ) {
116+ if ( serverContent && serverContent . turnComplete ) {
113117 done = true ;
114118 }
115119 }
0 commit comments