Skip to content

Commit

Permalink
fix:fallback match (#572)
Browse files Browse the repository at this point in the history
* fix:fallback match

the priority levels were not being respected, everything matched under fallback_high

* fix tests
  • Loading branch information
JarbasAl authored Oct 18, 2024
1 parent a26b7b7 commit 27d891e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ovos_core/intent_services/fallback_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,20 @@ def _collect_fallback_skills(self, message: Message,
def handle_ack(msg):
skill_id = msg.data["skill_id"]
if msg.data.get("can_handle", True):
if skill_id in self.registered_fallbacks:
if skill_id in in_range:
fallback_skills.append(skill_id)
LOG.info(f"{skill_id} will try to handle fallback")
LOG.info(f"{skill_id} will try to handle fallback")
else:
LOG.debug(f"{skill_id} is out of range, skipping")
else:
LOG.info(f"{skill_id} will NOT try to handle fallback")
LOG.debug(f"{skill_id} does NOT WANT to try to handle fallback")
skill_ids.append(skill_id)

if in_range: # no need to search if no skills available
self.bus.on("ovos.skills.fallback.pong", handle_ack)

LOG.info("checking for FallbackSkillsV2 candidates")
message.data["range"] = (fb_range.start, fb_range.stop)
# wait for all skills to acknowledge they want to answer fallback queries
self.bus.emit(message.forward("ovos.skills.fallback.ping",
message.data))
Expand Down
7 changes: 6 additions & 1 deletion test/end2end/session/test_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def wait_for_n_messages(n):
# confirm all expected messages are sent
expected_messages = [
"recognizer_loop:utterance",
# FallbackV2
# Fallback High
"ovos.skills.fallback.ping",
"ovos.skills.fallback.pong",
"ovos.skills.fallback.pong",
Expand All @@ -361,6 +361,11 @@ def wait_for_n_messages(n):
f"ovos.skills.fallback.{self.skill_id2}.response",
f"ovos.skills.fallback.{self.skill_id2}.killed", # killable_event decorator response

# Fallback Medium
"ovos.skills.fallback.ping",
"ovos.skills.fallback.pong",
"ovos.skills.fallback.pong",

# skill executing
f"ovos.skills.fallback.{self.skill_id}.request",
f"ovos.skills.fallback.{self.skill_id}.start",
Expand Down

0 comments on commit 27d891e

Please sign in to comment.