Skip to content

Commit

Permalink
fix: Interrupt is not a "play_media" parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Oct 14, 2024
1 parent 331da07 commit 1451f78
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions app/helpers/call_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ async def _handle_recognize_media( # noqa: PLR0913
raise e


async def _handle_play_text( # noqa: PLR0913
async def _handle_play_text(
call: CallStateModel,
client: CallAutomationClient,
context: ContextEnum | None,
interrupt_queue: bool,
style: MessageStyleEnum,
text: str,
) -> None:
Expand All @@ -146,7 +145,6 @@ async def _handle_play_text( # noqa: PLR0913
assert call.voice_id, "Voice ID is required for playing text"
async with _use_call_client(client, call.voice_id) as call_client:
await call_client.play_media(
interrupt_call_media_operation=interrupt_queue,
operation_context=_context_builder({context}),
play_source=_audio_from_text(
call=call,
Expand Down Expand Up @@ -248,7 +246,6 @@ async def handle_recognize_text( # noqa: PLR0913
call=call,
client=client,
context=context,
interrupt_queue=chunck_interrupt_queue,
style=style,
text=chunk,
)
Expand All @@ -259,7 +256,6 @@ async def handle_play_text( # noqa: PLR0913
client: CallAutomationClient,
text: str,
context: ContextEnum | None = None,
interrupt_queue: bool = False,
store: bool = True,
style: MessageStyleEnum = MessageStyleEnum.NONE,
) -> None:
Expand All @@ -277,16 +273,11 @@ async def handle_play_text( # noqa: PLR0913
)

# Play each chunk
for i, chunk in enumerate(chunks):
# For first chunk, interrupt media if needed
chunck_interrupt_queue = interrupt_queue if i == 0 else False

# Play text
for chunk in chunks:
await _handle_play_text(
call=call,
client=client,
context=context,
interrupt_queue=chunck_interrupt_queue,
style=style,
text=chunk,
)
Expand Down

0 comments on commit 1451f78

Please sign in to comment.