I am using rasa version 2.8
- story: search restaurant info + affirm
steps:
- intent: restaurant_info
- action: restaurant_info_form
- active_loop: restaurant_info_form
- slot_was_set:
- requested_slot: location
- action: action_deactivate_loop
- active_loop: null
- slot_was_set:
- requested_slot: null
- intent: affirm
- action: display_restaurant_data
- action: restart_conversation
This is my story I want to get information of a restaurant based on it’s location which will be provided by user in a form.
Now everything works but last action(restart_conversataion) doesn’t work, although the action is correct, it just resets all slots.
here is the action:
from rasa_sdk.events import Restarted
def ActionRestarted(Action):
def name(self):
return "restart_conversation"
def run(self,dispatcher,tracker,domain):
dispatcher.utter_message('slots reset')
return [Restarted()]
Now my question is can we write 2 or more consecutive actions together without an intent between them?
I know in rasa 1.x we can
Thanks
ChrisRahme
(Chris Rahmé)
December 3, 2021, 11:22am
2
What’s the problem with the restart? If the slots are reset, that’s the correct behavior as per the docs .
Anyway yes, you can write consecutive actions, or make use of the FollowupAction event.
ILG2021
(Ilg2021)
December 3, 2021, 11:34am
3
You mean you don’t want to reset the slots? Maybe you can try this:
carry_over_slots_to_new_session: false
in domain.yml
@ChrisRahme
According to docs my story and action is correct, I know that.
But after action: display_restaurant_data is executed, action: restart_conversation doesn’t get triggered.
Why is that any idea?
I want to reset the slot after every story is completed, but somehow 2 consecutive actions are not triggred(The 1st one is executed but not the second one)
ChrisRahme
(Chris Rahmé)
December 3, 2021, 12:04pm
6
It’s weird.
Maybe you need more stories doing this?
Anyway, my preference in that case is to use FollowupAction . Why not try it?
@ChrisRahme
So I should write my FollowupAction in my previous action?
example:
if I have 2 actions
action: display_restaurant_data
action: restart_conversation
so I should write my FollowupAction in display_restaurant_data ?
ChrisRahme
(Chris Rahmé)
December 3, 2021, 3:00pm
8
Yup,
return [Restarted(), FollowupAction(action_name)]
Thanks @ChrisRahme That helped
For other readers FollowupAction(“action_name”) use quotes for action name
1 Like
ChrisRahme
(Chris Rahmé)
December 5, 2021, 3:27pm
10
Yes of course, action_name
is a variable in my example
Glad to be of help anyway!
1 Like