refactor: formaliza formatos de áudio e alinhamento PCM
This commit is contained in:
@@ -12,7 +12,6 @@ from voice_assistant.application.events import SpeechChunk
|
||||
from voice_assistant.application.voice_session import VoiceSession
|
||||
from voice_assistant.domain.session import SessionState
|
||||
from voice_assistant.stt.mock import MockSTTAdapter
|
||||
from voice_assistant.tts.adapter import TTSAdapter
|
||||
from voice_assistant.tts.mock import MockTTSAdapter
|
||||
from voice_assistant.turn_manager import TurnManager
|
||||
from voice_assistant.voice_pipeline import VoicePipeline
|
||||
@@ -93,17 +92,17 @@ async def test_streaming_cancellation_releases_stream():
|
||||
async def test_stopping_synthesis_early_closes_provider_generator():
|
||||
closed = asyncio.Event()
|
||||
|
||||
class TTS(TTSAdapter):
|
||||
class TTS(MockTTSAdapter):
|
||||
async def synthesize(self, text):
|
||||
try:
|
||||
yield b"audio"
|
||||
yield b"audi"
|
||||
await asyncio.Event().wait()
|
||||
finally:
|
||||
closed.set()
|
||||
|
||||
pipeline = make_pipeline(MockAgentAdapter(), TTS())
|
||||
async with aclosing(pipeline.synthesize_response("Olá")) as stream:
|
||||
assert await anext(stream) == b"audio"
|
||||
assert await anext(stream) == b"audi"
|
||||
assert closed.is_set()
|
||||
|
||||
|
||||
@@ -113,10 +112,10 @@ async def test_interrupt_during_delivery_closes_nonstreaming_tts():
|
||||
synthesis_closed = asyncio.Event()
|
||||
stt = MockSTTAdapter()
|
||||
|
||||
class TTS(TTSAdapter):
|
||||
class TTS(MockTTSAdapter):
|
||||
async def synthesize(self, text):
|
||||
try:
|
||||
yield b"audio"
|
||||
yield b"audi"
|
||||
await asyncio.Event().wait()
|
||||
finally:
|
||||
synthesis_closed.set()
|
||||
|
||||
Reference in New Issue
Block a user