fix: Improve TranscriptProcessor detection for transcript type
This commit is contained in:
@@ -74,6 +74,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed an issue in the `TranscriptProcessor` where newline characters could
|
||||
cause the transcript output to be corrupted (e.g. missing all spaces).
|
||||
|
||||
- Fixed an issue in `AudioBufferProcessor` when using `SmallWebRTCTransport` where, if
|
||||
the microphone was muted, track timing was not respected.
|
||||
|
||||
|
||||
@@ -140,11 +140,13 @@ class AssistantTranscriptProcessor(BaseTranscriptProcessor):
|
||||
Result: "Hello there how are you"
|
||||
"""
|
||||
if self._current_text_parts and self._aggregation_start_time:
|
||||
# Check specifically for space characters, previously isspace() was used
|
||||
# but that includes all whitespace characters (e.g. \n), not just spaces.
|
||||
has_leading_spaces = any(
|
||||
part and part[0].isspace() for part in self._current_text_parts[1:]
|
||||
part and part[0] == " " for part in self._current_text_parts[1:]
|
||||
)
|
||||
has_trailing_spaces = any(
|
||||
part and part[-1].isspace() for part in self._current_text_parts[:-1]
|
||||
part and part[-1] == " " for part in self._current_text_parts[:-1]
|
||||
)
|
||||
|
||||
# If there are embedded spaces in the fragments, use direct concatenation
|
||||
|
||||
Reference in New Issue
Block a user