@@ -71,15 +71,14 @@ internal constructor(
7171
7272  @Serializable internal  data class  ToolCall (val  functionCalls :  List <FunctionCallPart .Internal .FunctionCall >)
7373
74-   public  fun  receiveFunctionCalls (): Flow <List <FunctionCallPart >> {
74+   public  fun  receiveAudioConvoFunctionCalls (): Flow <List <FunctionCallPart >> {
7575    return  functionCallChannel.receiveAsFlow()
7676  }
7777  public  suspend  fun  startAudioConversation (){
7878    if  (isRecording) {
7979      return 
8080    }
8181    functionCallChannel =  Channel ()
82-     println (" Started Receiving"  )
8382    isRecording =  true 
8483    audioHelper =  AudioHelper ()
8584    audioHelper!! .setupAudioTrack()
@@ -131,8 +130,9 @@ internal constructor(
131130        } else  if (it.status ==  Status .NORMAL ) {
132131          if (! it.functionCalls.isNullOrEmpty()) {
133132            functionCallChannel.send(it.functionCalls)
133+           } else  {
134+             playBackQueue.add(it.data!! .parts[0 ].asInlineDataPartOrNull()!! .inlineData)
134135          }
135-           playBackQueue.add(it.data!! .parts[0 ].asInlineDataPartOrNull()!! .inlineData)
136136        }
137137      }
138138    }
@@ -147,6 +147,7 @@ internal constructor(
147147        }
148148      }
149149    }
150+     delay(1000 )
150151  }
151152
152153  public  fun  stopAudioConversation () {
@@ -236,15 +237,8 @@ internal constructor(
236237  ) {
237238    val  jsonString = 
238239      Json .encodeToString(MediaStreamingSetup (MediaChunks (mediaChunks.map { it.toInternal() })))
239-     println (jsonString)
240240    session?.send(Frame .Text (jsonString))
241241  }
242-   /* 
243-   ChunkSize: fits two letters [hel, lo] 
244- 
245- 
246- 
247-    */  
248242
249243  public  suspend  fun  send (content :  Content ){
250244    val  jsonString = 
@@ -253,7 +247,6 @@ internal constructor(
253247          ClientContent (listOf (content.toInternal()), true )
254248        )
255249      )
256-     println (jsonString)
257250    session?.send(Frame .Text (jsonString))
258251  }
259252  public  suspend  fun  send (text :  String ){
0 commit comments