MycroftAI / mycroft-core

Mycroft Core, the Mycroft Artificial Intelligence platform.
https://mycroft.ai
Apache License 2.0
6.51k stars 1.27k forks source link

Add a global method to cancel all interactive / non interactive dialogs #2810

Open AIIX opened 3 years ago

AIIX commented 3 years ago

Is your feature request related to a problem? Please describe. There seems to be no method available for cancelling a non interactive dialog self.dialog or interactive dialog self.get_response or self.ask_yesno dialog

Case problem scenario:

Describe the solution you'd like Allow skill authors to decide when they would like the speech interaction and spoken dialogs to cancel programmatically via following methods

JarbasAl commented 3 years ago

the problems goes deeper than that, if you make an intent with an infinite loop and dont handle it in stop it will keep going forever, if you cancel a dialog and the intent just starts another one you still have a problem

i recall some bug reports with the fairy tale reading skill about this exact issue, mycroft needs a mechanism to kill execution of random arbitrary code from skills

check my solution here https://github.com/OpenVoiceOS/ovos_utils/pull/34

krisgesling commented 3 years ago

Hey, thanks for writing this up. Very much agree that it's something we need to address.

It seems like there may be two sides of this that we may want to handle separately - the audible speech output, and the Skill process. From that come a range of possible user stories:

  1. As a User, I can interrupt what Mycroft is saying.
    • In this all I care about is stopping the audible speech output, so that I can speak another utterance, or just stop Mycroft talking.
  2. As a User, I can stop a Skill from continuing what it's doing.
  3. As a Skill Developer, I can stop dialog being spoken that was initiated by my Skill.
  4. As a Skill Developer, I can prevent Mycroft speaking while my Skill is active.
    • This one will need some discussion - it feels like there are likely negative consequences here - eg what about reminder notifications.
  5. As a Skill Developer, I can kill an existing handler within my Skill.
    • This one feels strange, the existence of this issue probably points to a different problem. Eg we fixed the Fairy Tale Skill so users could say stop and it would end after that sentence.
  6. As a Release Manager, I can stop the execution of any Skill.
    • Under what conditions?
  7. As a Release Manager, I can set a maximum allowable execution time for intents, at which point the process will be stopped.

Interested to hear your thoughts, or whether this is veering off into a completely different direction.

AIIX commented 3 years ago
  • As a Skill Developer, I can stop dialog being spoken that was initiated by my Skill.

  • As a Skill Developer, I can prevent Mycroft speaking while my Skill is active.

    • This one will need some discussion - it feels like there are likely negative consequences here - eg what about reminder notifications.
  • As a Skill Developer, I can kill an existing handler within my Skill.

    • This one feels strange, the existence of this issue probably points to a different problem. Eg we fixed the Fairy Tale Skill so users could say stop and it would end after that sentence.

I think this issue does cover at least some scenarios above, but I would like to stress immediately on the GUI direction/side because as a skill developer working on implementing both GUI and VUI I find that without having those methods available it becomes very difficult to develop a consistent experience and sync where authors can programmatically stop dialogs and speech when pages change or new content is displayed.

Rest of the user stories make sense, but they could be probably solved separately because they touch different cases.