hanifabd
(Hanif Yuli Abdillah P)
1
Hi i have a scenario to achieve here
so i want to update a value of a slot, how can i achive that?
EXPECTED SCENARIO:
User: Hey i need help 1
Bot: What can i help you
User: (NOTE: this user’s answer saved in slot named PROBLEM) blablablabla…
Bot: Bot gives the solution 1
User: I need help again 2
Bot: What can i help you
User: (NOTE: this user’s answer saved in slot named PROBLEM) blablablabla…
Bot: Bot gives the solution 2
the bold part are not working because slot value for problem aren’t null, and what happened is like this
SCENARIO GOTTEN:
User: Hey i need help 1
Bot: What can i help you
User: (NOTE: this user’s answer saved in slot named PROBLEM) blablablabla…
Bot: Bot gives the solution 1
User: I need help again 2
Bot: What can i help you
User: (skipped because the action_loop detect the PROBLEM slot is not null)
Bot: Bot gives the solution 1 (gives the solution for the first problem not the second problem)
SangeMax97
(Sange Maxaku)
2
You can reset the slot after the help intent, before activating the form. Here’s a possible scenario that uses rules:
- rule: activate help form
steps:
- intent: user_needs_help
- action: action_reset_problem
- action: help_form
- active_loop: help_form
- rule: submit help form
condition:
- active_loop: help_form
steps:
- action: help_form
- active_loop: null
- slot_was_set:
- requested_slot: null
- action: action_provide_help
hanifabd
(Hanif Yuli Abdillah P)
3
Thanks for the answer, i wanna ask about this part
- action: action_reset_problem
have i made that part using custom action or something like rasa built in action to reset the problem
slot?
SangeMax97
(Sange Maxaku)
4
This will be a custom action that resets the problem slot. Here’s how it will look:
class ActionResetProblem(Action):
def name(self) -> Text:
return "action_reset_problem"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
return [SlotSet("problem", None)]
1 Like
hanifabd
(Hanif Yuli Abdillah P)
5
Oh thats nice, thanks for your help sir, let me try that
hanifabd
(Hanif Yuli Abdillah P)
6
Its work, thank you very much for your help
1 Like