-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add intent fallback system #899
Conversation
Also removes multi utterence intent fail. Only makes sense to emit an intent_failure regardless of the amount of intents
3e81378 to
52f2629
Compare
mycroft/skills/core.py
Outdated
| while priority in MycroftSkill.fallback_handlers: | ||
| priority += 1 | ||
|
|
||
| MycroftSkill.fallback_handlers[priority] = handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, if have another skill with the same priority it's gonna override the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should keep incrementing the priority in the two lines of code above until there is no handler at that priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't saw
|
Would it be an idea to subclass a FallbackSkill from MycroftSkill with these new methods? MycroftSkill keeps growing (Partly my own fault) and this may be a good oppurtunity to split off some parts. Backwards compatibility might be tricky but worst case would be a fork of the original wolfram skill. |
This makes it more concise and mimics the behavior of self, but for static methods
|
@forslund Yeah, I love the idea! Just implemented. |
|
@MatthewScholefield, looks great! |
ethanaward
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This is because this will break wolfra alpha skill unless they update skills, but if they update before getting the new version, it will also break wolfram This reverts commit 6ca4161.
This is a new system that allows other skills to register as fallbacks to handle general knowledge queries. For now, each skill self-assigns a priority where
0is thehighestand100is very low priority. When an intent failure occurs, each fallback gets run until one returns True meaning it found a response to speak to the user. Example usage:skill-my-fallback/__init__.py:This PR also removes the multi utterance intent fail. It only makes sense to emit an
intent_failureregardless of the amount of intents, especially since we only ever receive one utterance anymore.This PR relies on this PR in skill-wolfram-alpha. Instructions for testing:
Then test functionality of Wolfram Alpha for questions like
what is a fox(and maybe wolfram skill reloading when/opt/mycroft/skill-wolfram-alpha/__init__.pyis edited).