Skip to content

Commit

Permalink
add "ovos.utterance.cancelled" event (#404)
Browse files Browse the repository at this point in the history
emit a bus event and exit faster if utterance is canceled

example cancel plugin https://github.com/OpenVoiceOS/ovos-utterance-plugin-cancel
  • Loading branch information
JarbasAl authored Jan 24, 2024
1 parent 9e46827 commit 972b319
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ def handle_utterance(self, message):

# Get utterance utterance_plugins additional context
message = self._handle_transformers(message)

if message.context.get("canceled"):
# TODO - play dedicated sound
LOG.info("utterance canceled, cancel_word:" + message.context.get("cancel_word"))
self.bus.emit(message.reply("ovos.utterance.cancelled"))
return

# tag language of this utterance
lang = self.disambiguate_lang(message)
Expand Down

0 comments on commit 972b319

Please sign in to comment.