Closed
Description
Normally, you expect /restart
to reset all slots (dump their values). However, I found a way to bring such "dead" slot values back to life 👻 which occurs in 3.0rc2 but not in 2.8.
Example set-up is similar to this: To a rasa init
project add these domain parts:
intents:
- inform
responses:
utter_ask_slot_0:
- text: "Let's start this form. Say something!"
utter_ask_slot_A:
- text: "Could you, possibly, please, give me a city."
utter_ask_slot_B:
- text: "Yo pal gimme a city!"
entities:
- city
slots:
slot_0:
type: any
mappings:
- type: from_text
not_intent: greet
slot_A:
type: any
mappings:
- type: from_entity
entity: city
conditions:
- active_loop: my_form
slot_B:
type: any
mappings:
- type: from_entity
entity: city
conditions:
- active_loop: my_form
forms:
my_form:
required_slots:
- slot_0
- slot_A
- slot_B
some NLU data for the new intent & entity:
- intent: inform
examples: |
- [Bratislava](city)
- [Berlin](city)
- [Prague](city)
- [Amsterdam](city)
- [Edinburgh](city)
the complete rules will look like this:
version: "2.0"
rules:
- rule: Say goodbye anytime the user says goodbye
steps:
- intent: goodbye
- action: utter_goodbye
- rule: Say 'I am a bot' anytime the user challenges
steps:
- intent: bot_challenge
- action: utter_iamabot
- rule: Activate form
steps:
- intent: greet
- action: my_form
- active_loop: my_form
- rule: Submit form
condition:
- active_loop: my_form
steps:
- action: my_form
- active_loop: null
- slot_was_set:
- requested_slot: null
- action: utter_happy
and you'll have to comment out all stories.
Then, rasa train
the bot and rasa shell --debug
talk to it. Below is the sequence of user messages and the interesting slots after the message has been processed, as reported by rasa shell
:
message slot_0 slot_A slot_B
hi None None None
Berlin Berlin None None
Bratislava Bratislava Bratislava None
Prague Prague Bratislava Prague
/restart None None None
hi None None None
Bratislava Bratislava Bratislava Prague
Notice how all slots are reported to be reset after /restart
but old values come back to life after the last message.