Let’s suppose that I have a form and every slot is filled by a custom action in my file
actions.py. Also, from the docs we see that step nº2 states the following:
- Make sure that in the domain file you list for your form only those slots that use predefined mappings.
After seeing this my
domain.yml has defined a form like this:
And when I run
rasa shell I get the following error:
2021-04-30 19:13:55 ERROR rasa.core.processor - Encountered an exception while running action 'contract_form'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information. Traceback (most recent call last): File "/home/jsv/Documents/CARRERA/tfg4/resources/rasa-chatbot/.env/lib/python3.6/site-packages/rasa/core/processor.py", line 773, in _run_action output_channel, nlg, temporary_tracker, self.domain File "/home/jsv/Documents/CARRERA/tfg4/resources/rasa-chatbot/.env/lib/python3.6/site-packages/rasa/core/actions/loops.py", line 26, in run events += await self.activate(output_channel, nlg, tracker, domain) File "/home/jsv/Documents/CARRERA/tfg4/resources/rasa-chatbot/.env/lib/python3.6/site-packages/rasa/core/actions/forms.py", line 706, in activate for slot_name in self.required_slots(domain): File "/home/jsv/Documents/CARRERA/tfg4/resources/rasa-chatbot/.env/lib/python3.6/site-packages/rasa/core/actions/forms.py", line 58, in required_slots return list(domain.slot_mapping_for_form(self.name()).keys()) AttributeError: 'NoneType' object has no attribute 'key
I’ve tried to add a simple if statement in
forms.py checking for a None in
domain.slot_mapping_for_form(self.name()) and return an empty list if that is true, but It gives me an error in rasa_sdk as it isn’t prepared to handle empty lists, so I think that’s not the way to solve it.
Then I’ve tried to add to my
domain.yml a dummy slot like this:
forms: contract_form: dont_crash: - type: from_text
This kind solves the problem, it only complains saying that it hasn’t found any slot like that one, but continues with the execution.
Is there a better way to solve this problem? Do you have any thoughts on this? @fkoerner