Older versions of the assistant SDK don't have the ON_RENDER_RESPONSE event - check if they have it defined before testing the event type

This commit is contained in:
Fabio Manganiello 2018-06-21 01:29:04 +02:00
parent 8708d53236
commit a4273f5619

View file

@ -52,7 +52,7 @@ class AssistantGoogleBackend(Backend):
self.bus.post(ConversationTimeoutEvent())
elif event.type == EventType.ON_NO_RESPONSE:
self.bus.post(NoResponseEvent())
elif event.type == EventType.ON_RENDER_RESPONSE:
elif hasattr(EventType, 'ON_RENDER_RESPONSE') and event.type == EventType.ON_RENDER_RESPONSE:
self.bus.post(ResponseEvent(response_text=event.args.get('text')))
elif event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED:
phrase = event.args['text'].lower().strip()