Hi! I’m using Rasa 3.6.13-full version and currenctly I’m facing a issue when using slot_was_set
as a condition in my rules.
I have these rules, the first one I want to run when the user is greeting the bot for the first time in the session. I want the bot to say “hi” as well, send the user a message with tips on how to use the bot, and then trigger a form to fill a slot related to the user’s identity.
The second rule handles the cases where the user says “hi” to the bot again in the same session. I don’t need to fill the slot again and I don’t want to send chat chips, so I just send a response with something like “hi again”.
rules:
- rule: Greet The User and Activate cnpj form
condition:
- slot_was_set:
- user_was_greeted: false
steps:
- intent: greet
- action: greet_the_user
- action: action_help_with_features
- action: cnpj_form
- active_loop: cnpj_form
- rule: Just Greet The User Again
condition:
- slot_was_set:
- user_was_greeted: true
steps:
- intent: greet
- action: utter_greet_again
# OTHER RULES ...
The problem is:
When I greet the bot for the first time, my Custom Action (you can see the code below) is triggered correctly, BUT the other actions that follow are not executed. I suspect this is because when I use SlotSet and set the slot value to True, Rasa triggers the second rule and ignores the rest of the first one.
class ActionGreetTheUser(Action):
def name(self) -> Text:
return "greet_the_user"
async def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],) -> List[Dict[Text, Any]]:
Debugger().info(f"ActionGreetTheUser.run: tracker.slots={tracker.slots}")
dispatcher.utter_message(response=UTTER_GREET)
dispatcher.utter_message(response=UTTER_IAMBOT)
return [SlotSet("user_was_greeted", True)]
Can anyone help me?
Other solutions to execute different paths when the user greets the bot are also welcome!