Skip to content

Commit

Permalink
list for skips instead of hardcoded fallback/converse kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Aug 7, 2023
1 parent 7b24f83 commit ad4aa9c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def disambiguate_lang(message):

return default_lang

def get_pipeline(self, skip_converse=False, skip_fallback=False):
def get_pipeline(self, skips=None):
"""return a list of matcher functions ordered by priority
utterances will be sent to each matcher in order until one can handle the utterance
the list can be configured in mycroft.conf under intents.pipeline,
Expand Down Expand Up @@ -252,11 +252,8 @@ def get_pipeline(self, skip_converse=False, skip_fallback=False):
"padacioso_low": self.padacioso_service.match_low,
"fallback_low": self.fallback.low_prio
}
matchers = {k: v for k, v in matchers.items() if k not in skips}
pipeline = list(self.pipeline)
if skip_converse and "converse" in pipeline:
pipeline.remove("converse")
if skip_fallback:
pipeline = [p for p in pipeline if not p.startswith("fallback_")]
return [matchers[k] for k in pipeline]

def handle_utterance(self, message):
Expand Down Expand Up @@ -441,7 +438,10 @@ def handle_get_intent(self, message):
lang = get_message_lang(message)

# Loop through the matching functions until a match is found.
for match_func in self.get_pipeline(skip_converse=True, skip_fallback=True):
for match_func in self.get_pipeline(skips=["converse",
"fallback_high",
"fallback_medium",
"fallback_low"]):
match = match_func([utterance], lang, message)
if match:
if match.intent_type:
Expand Down

0 comments on commit ad4aa9c

Please sign in to comment.