File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -62,15 +62,15 @@ async function generateContent(
6262 const message = await waitMessage ( ) ;
6363
6464 const sc = message . serverContent ;
65- if ( sc . modelTurn . parts ) {
65+ if ( sc && sc . modelTurn && sc . modelTurn . parts ) {
6666 for ( const part of sc . modelTurn . parts ) {
67- if ( part . inlineData . data ) {
67+ if ( part && part . inlineData && part . inlineData . data ) {
6868 audioChunks . push ( Buffer . from ( part . inlineData . data ) ) ;
6969 }
7070 }
7171 }
7272
73- if ( sc . turnComplete ) {
73+ if ( sc && sc . turnComplete ) {
7474 done = true ;
7575 }
7676 }
Original file line number Diff line number Diff line change @@ -56,17 +56,16 @@ async function generateContent(
5656 turns . push ( message ) ;
5757
5858 const sc = message . serverContent ;
59- if ( sc . modelTurn ) {
59+ if ( sc && sc . modelTurn ) {
6060 console . log ( 'Model turn:' , sc . modelTurn ) ;
6161 }
62- if ( sc . inputTranscription ) {
62+ if ( sc && sc . inputTranscription ) {
6363 console . log ( 'Input transcript:' , sc . inputTranscription . text ) ;
6464 }
65- if ( sc . outputTranscription . text ) {
65+ if ( sc && sc . outputTranscription && sc . outputTranscription . text ) {
6666 outputMessage . push ( sc . outputTranscription . text ) ;
6767 }
68-
69- if ( sc . turnComplete ) {
68+ if ( sc && sc . turnComplete ) {
7069 done = true ;
7170 }
7271 }
You can’t perform that action at this time.
0 commit comments