Fix finalization pattern: Use request/confirm in Pipecat mode, finalized flag in STT mode
- Add request_finalize() before sending ForceEndpoint in Pipecat mode - Keep confirm_finalize() when receiving formatted finals in Pipecat mode - Remove confirm_finalize() from STT mode (use finalized=True instead) This follows Pipecat's two-step finalization pattern where request_finalize() is called when sending a finalize request to the STT service, and confirm_finalize() is called when receiving confirmation back.
This commit is contained in:
@@ -438,6 +438,7 @@ class AssemblyAISTTService(WebsocketSTTService):
|
|||||||
and self._websocket
|
and self._websocket
|
||||||
and self._websocket.state is State.OPEN
|
and self._websocket.state is State.OPEN
|
||||||
):
|
):
|
||||||
|
await self.request_finalize()
|
||||||
await self._websocket.send(json.dumps({"type": "ForceEndpoint"}))
|
await self._websocket.send(json.dumps({"type": "ForceEndpoint"}))
|
||||||
await self.start_processing_metrics()
|
await self.start_processing_metrics()
|
||||||
|
|
||||||
@@ -761,8 +762,7 @@ class AssemblyAISTTService(WebsocketSTTService):
|
|||||||
self._user_speaking = True
|
self._user_speaking = True
|
||||||
|
|
||||||
if is_final_turn:
|
if is_final_turn:
|
||||||
if message.turn_is_formatted:
|
# STT mode: AssemblyAI controls finalization, just mark as finalized
|
||||||
self.confirm_finalize()
|
|
||||||
await self.push_frame(
|
await self.push_frame(
|
||||||
TranscriptionFrame(
|
TranscriptionFrame(
|
||||||
transcript_text,
|
transcript_text,
|
||||||
|
|||||||
Reference in New Issue
Block a user