Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor/fallback_skills_v2 #66

Merged
merged 8 commits into from
Apr 25, 2023
Merged

refactor/fallback_skills_v2 #66

merged 8 commits into from
Apr 25, 2023

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Apr 20, 2023

make fallback skills use the bus like all other skills

companion to OpenVoiceOS/ovos-core#307

relevant discussion: MycroftAI/mycroft-core#2806

class OVOSFallbackSkill(OVOSSkill):
    """
    Fallbacks come into play when no skill matches an intent.  
    
    Fallback handlers are called in an order determined the 
    priority provided when the skill is registered.

    Handlers with the numerically lowest priority are invoked first.
    Multiple fallbacks can exist at the same priority, but no order is
    guaranteed.

    A Fallback can either observe or consume an utterance. A consumed
    utterance will not be see by any other Fallback handlers.
    
    A skill might register several handlers, the lowest priority will be reported to core
    If a skill is selected by core then all handlers are checked by 
    their priority until one can handle the utterance
    
    A skill may return False in the can_answer method to request 
    that core does not execute it's fallback handlers
    """

    def can_answer(self, utterances, lang):
        """Check if the skill can answer the particular question.


        Arguments:
            utterances (list): list of possible transcriptions to parse
            lang (str) : lang code
        Returns:
            (bool) True if skill can handle the query
        """
        return len(self._fallback_handlers) > 0


    ```

@JarbasAl JarbasAl added enhancement New feature or request refactor code improvements with no functional changes labels Apr 20, 2023
@JarbasAl JarbasAl requested review from NeonDaniel and a team April 20, 2023 02:33
@JarbasAl JarbasAl force-pushed the refactor/fallback_skills_v2 branch from f179b76 to ecd8c78 Compare April 20, 2023 02:34
@JarbasAl JarbasAl force-pushed the refactor/fallback_skills_v2 branch from 1afb4ef to b57f785 Compare April 21, 2023 01:11
@JarbasAl JarbasAl force-pushed the refactor/fallback_skills_v2 branch from 11763f6 to 8e2932c Compare April 23, 2023 22:39
@JarbasAl JarbasAl requested a review from goldyfruit April 23, 2023 22:55
@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

❗ No coverage uploaded for pull request base (dev@d87602b). Click here to learn what that means.
The diff coverage is n/a.

@@          Coverage Diff          @@
##             dev     #66   +/-   ##
=====================================
  Coverage       ?   0.00%           
=====================================
  Files          ?      33           
  Lines          ?    3154           
  Branches       ?       0           
=====================================
  Hits           ?       0           
  Misses         ?    3154           
  Partials       ?       0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@NeonDaniel NeonDaniel left a 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

@JarbasAl JarbasAl merged commit ae7d93d into dev Apr 25, 2023
@JarbasAl JarbasAl deleted the refactor/fallback_skills_v2 branch April 25, 2023 17:42
@github-actions github-actions bot mentioned this pull request Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor code improvements with no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants