forked from platypush/platypush
IntentRecognizedEvent
should stop the current assistant conversation when matched by a hook.
This commit is contained in:
parent
1cc2aaf5a4
commit
c7d640a1d2
1 changed files with 12 additions and 1 deletions
|
@ -147,7 +147,7 @@ class SpeechRecognizedEvent(AssistantEvent):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result = super().matches_condition(condition)
|
result = super().matches_condition(condition)
|
||||||
if result.is_match and self.assistant and 'phrase' in condition.args:
|
if result.is_match and self.assistant and condition.args.get('phrase'):
|
||||||
self.assistant.stop_conversation()
|
self.assistant.stop_conversation()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -242,6 +242,17 @@ class IntentRecognizedEvent(AssistantEvent):
|
||||||
"""
|
"""
|
||||||
super().__init__(*args, intent=intent, slots=slots or {}, **kwargs)
|
super().__init__(*args, intent=intent, slots=slots or {}, **kwargs)
|
||||||
|
|
||||||
|
def matches_condition(self, condition):
|
||||||
|
"""
|
||||||
|
Overrides matches condition, and stops the conversation to prevent the
|
||||||
|
default assistant response if the event matched some event hook condition.
|
||||||
|
"""
|
||||||
|
result = super().matches_condition(condition)
|
||||||
|
if result.is_match and self.assistant:
|
||||||
|
self.assistant.stop_conversation()
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def _matches_argument(
|
def _matches_argument(
|
||||||
self, argname, condition_value, event_args, result: EventMatchResult
|
self, argname, condition_value, event_args, result: EventMatchResult
|
||||||
):
|
):
|
||||||
|
|
Loading…
Reference in a new issue