Skip to content

Commit

Permalink
Merge pull request #5366 from DomAmato/bugfix/fallback
Browse files Browse the repository at this point in the history
Fix bug where Fallback Policy always falls back when fallback action is action listen
  • Loading branch information
chkoss authored Mar 16, 2020
2 parents 3a49f2a + 71be250 commit 807d9b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog/5356.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed bug where ``FallbackPolicy`` would always fall back if the fallback action is
``action_listen``.
10 changes: 9 additions & 1 deletion rasa/core/policies/fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ def predict_action_probabilities(

nlu_data = tracker.latest_message.parse_data

if tracker.latest_action_name == self.fallback_action_name:
if (
tracker.latest_action_name == self.fallback_action_name
and tracker.latest_action_name != ACTION_LISTEN_NAME
):
logger.debug(
"Predicted 'action_listen' after fallback action '{}'".format(
self.fallback_action_name
)
)
result = self._default_predictions(domain)
idx = domain.index_for_action(ACTION_LISTEN_NAME)
result[idx] = 1.0
Expand Down

0 comments on commit 807d9b0

Please sign in to comment.