fix: AudioBufferProcessor has_audio returns based on user or bot audio existing
This commit is contained in:
@@ -27,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue in `AudioBufferProcessor` where a recording is not created
|
||||||
|
when a bot speaks and user input is blocked.
|
||||||
|
|
||||||
- Fixed a `FastAPIWebsocketTransport` and `SmallWebRTCTransport` issue where
|
- Fixed a `FastAPIWebsocketTransport` and `SmallWebRTCTransport` issue where
|
||||||
`on_client_disconnected` would be triggered when the bot ends the
|
`on_client_disconnected` would be triggered when the bot ends the
|
||||||
conversation. That is, `on_client_disconnected` should only be triggered when
|
conversation. That is, `on_client_disconnected` should only be triggered when
|
||||||
|
|||||||
@@ -137,12 +137,12 @@ class AudioBufferProcessor(FrameProcessor):
|
|||||||
return self._num_channels
|
return self._num_channels
|
||||||
|
|
||||||
def has_audio(self) -> bool:
|
def has_audio(self) -> bool:
|
||||||
"""Check if both user and bot audio buffers contain data.
|
"""Check if either user or bot audio buffers contain data.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if both buffers contain audio data.
|
True if either buffer contains audio data.
|
||||||
"""
|
"""
|
||||||
return self._buffer_has_audio(self._user_audio_buffer) and self._buffer_has_audio(
|
return self._buffer_has_audio(self._user_audio_buffer) or self._buffer_has_audio(
|
||||||
self._bot_audio_buffer
|
self._bot_audio_buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user