May i ask how to get back to the story which was interrupted by another story in the middle? For example the bot works good in Story 1 and at one middle step, Story 2 (e.g. ask weather etc) comes in and interrupted. Is there any methods in rasa-sdk or any better way to get back to the exact break point in story 1 and finish the rest of steps after finishing story 2?
Hi @jhzape, there are various ways to achieve this as long as you have rules or stories for these things. You can find a user guide on this topic here. For questions like ask weather, you can just write a rule and the bot will automatically continue where it left off once that interaction is complete
Thanks for your reply @akelad. But my case is somehow different to the link you shared. Since Story 2 is firstly an multi-turn interaction (adjust app volume and send/receive commands to/from android app by custom payload), not in a form, but can take place at any step not only in Story 1, but also in Story 3… Story N. It seems to me that adding Story 2 to each other stories is too cumbersome.
I tried the way that changing sender_id, so that the main dialog is with sender_id “A” and interruption dialog can work under sender_id “B”. What I expected is once the interruption dialog is done and I switch sender_id from “B” to “A”, the main dialog should continue as no interruption occurs. But I failed.
I was wondering if tracker can help in some way, which can remove the interruption dialog and go back to the action before the break point. I hope I make it clear to you.
I’ve struggled with this for a long time as well, and long story short, RASA doesn’t have multi-turn interruption built in.
There are workarounds, but you will be doing complicated things that RASA was probably not designed for.
First things first, when Story 1 is interrupted, you will have to use a custom action to store the last bot utterance in a slot. You can do this by looking at the tracker within the custom action itself and getting the last bot utterance from there.
The second part is more tricky. It will depend on how your project has been coded and setup. The important thing to note is that RASA can’t resume from the middle of a story.
So how do you get around that?
Ensure that each of your utterances has a unique intent. This pretty much only works if your project is entirely a decision tree based system. So when Story 2 ends, you run a custom action to get the last bot utterance from the slot it was stored in and use FollowUpAction() to force the bot to repeat the last message in Story 1. Remember, RASA cannot resume from the middle of a story, so if that utterance is in the middle of a story, RASA will not be able to correctly predict the next action. Which is why your intents need to be unique so that RASA can know where to go from there.
Judicious use of UserUtteranceReverted()/ActionReverted()/FollowupAction() to rewind the tracker to the point where you left off in Story 1. This of course has a lot of drawbacks as well. Essentially, you will be running a custom action to loop through the tracker, and rewind each action until you get to the last bot utterance in Story 1. This method is more helpful as you would end up back before the interruption and can continue with the story. Before doing the rewinding, you can store the slot values internally first then use SlotSet() to ensure that the slots are passed on even after the actions have been rewinded.
WARNING: I have not tested these methods fully and they might mess up your project. This is also not something that RASA is designed for, so doing this might mess up your project.
Hi @YuaNWA, thanks a lot for such detailed explanation and i am impressed by the research you have done so far. I will give a try on the 2rd way to see if the bot can handle it or not.
@YuaNWA Do you know if timestamp of an action can control which action the bot should revert to? I tried to use timestamp to control the conversation flow, but I had no progress so far and posted a new topic. Could you please have a look at it?