MCPcopy Create free account
hub / github.com/akdeb/ElatoAI / process_frame

Method process_frame

server/fastapi/bot.py:61–85  ·  view source on GitHub ↗
(self, frame: Frame, direction: FrameDirection)

Source from the content-addressed store, hash-verified

59 self._voice_route = voice_route
60
61 async def process_frame(self, frame: Frame, direction: FrameDirection):
62 await super().process_frame(frame, direction)
63
64 if isinstance(frame, InputTransportMessageFrame):
65 message = frame.message if isinstance(frame.message, dict) else {}
66 msg_type = message.get("type")
67 msg = message.get("msg")
68
69 if msg_type == "instruction" and msg == "end_of_speech":
70 if self._voice_route == "gem_live":
71 await self.push_frame(VADUserStoppedSpeakingFrame(), FrameDirection.DOWNSTREAM)
72 else:
73 await self.push_frame(
74 EmulateUserStoppedSpeakingFrame(), FrameDirection.DOWNSTREAM
75 )
76 await self.push_frame(STTMuteFrame(mute=True), FrameDirection.DOWNSTREAM)
77 return
78
79 if msg_type == "instruction" and msg == "INTERRUPT":
80 await self.push_frame(InterruptionFrame(), FrameDirection.DOWNSTREAM)
81 if self._voice_route != "gem_live":
82 await self.push_frame(STTMuteFrame(mute=False), FrameDirection.DOWNSTREAM)
83 return
84
85 await self.push_frame(frame, direction)
86
87
88class RealtimeOutputControlProcessor(FrameProcessor):

Callers 1

process_frameMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected