in src/dfcx_scrapi/core/conversation.py [0:0]
def _gather_response_messages(self, response_messages):
rm_gathered = []
for msg in response_messages:
if msg.payload:
msg = {
"payload": self.recurse_proto_marshal_to_dict(msg.payload)
}
elif msg.play_audio:
msg = {"play_audio": {"audio_uri": msg.play_audio.audio_uri}}
elif msg.live_agent_handoff:
msg = {
"live_agent_handoff": self.recurse_proto_marshal_to_dict(
msg.live_agent_handoff.metadata
)
}
elif msg.conversation_success:
msg = {
"conversation_success": self.recurse_proto_marshal_to_dict(
msg.conversation_success.metadata
)
}
elif msg.output_audio_text:
msg = {"output_audio_text": msg.output_audio_text.text}
elif msg.text:
msg = {"text": self._gather_text_responses(msg.text)}
rm_gathered.append(msg)
return rm_gathered