refactor: formaliza formatos de áudio e alinhamento PCM
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from voice_assistant.agent.adapter import StreamingAgentAdapter
|
||||
from voice_assistant.tts.adapter import TTSAdapter
|
||||
import asyncio
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from contextlib import contextmanager
|
||||
@@ -1865,9 +1864,9 @@ def test_websocket_streaming_agent_and_tts():
|
||||
yield "Olá, como posso ajudar?"
|
||||
yield " Estou à disposição."
|
||||
|
||||
class StreamingTestTTS(TTSAdapter):
|
||||
class StreamingTestTTS(MockTTSAdapter):
|
||||
async def synthesize(self, text):
|
||||
yield text.encode("utf-8")
|
||||
yield text.encode("utf-16-le")
|
||||
|
||||
with patch.object(
|
||||
main,
|
||||
@@ -1967,7 +1966,7 @@ def test_websocket_interrupt_during_streaming_tts():
|
||||
async def stream(self, session_id, turn_id, text):
|
||||
yield "Olá, esta é uma resposta longa."
|
||||
|
||||
class SlowStreamingTTS(TTSAdapter):
|
||||
class SlowStreamingTTS(MockTTSAdapter):
|
||||
async def synthesize(self, text):
|
||||
try:
|
||||
tts_started.set()
|
||||
@@ -2106,7 +2105,7 @@ def test_websocket_session_end_during_streaming_tts():
|
||||
async def stream(self, session_id, turn_id, text):
|
||||
yield "Esta é uma resposta longa."
|
||||
|
||||
class SlowStreamingTTS(TTSAdapter):
|
||||
class SlowStreamingTTS(MockTTSAdapter):
|
||||
async def synthesize(self, text):
|
||||
try:
|
||||
yield b"\x01\x02\x03\x04"
|
||||
@@ -2303,7 +2302,7 @@ def test_websocket_interrupt_wins_pending_tts_completion():
|
||||
async def stream(self, session_id, turn_id, text):
|
||||
yield "Esta resposta será interrompida."
|
||||
|
||||
class ControlledTTS(TTSAdapter):
|
||||
class ControlledTTS(MockTTSAdapter):
|
||||
async def synthesize(self, text):
|
||||
try:
|
||||
yield b"\x01\x02\x03\x04"
|
||||
|
||||
Reference in New Issue
Block a user