Calculator with multiple outcomes

Hey!

I’m building a chatbot that does a questionnaire. Each question is answered by the user in the form of a number from 0-4. These numbers are, at the end, summed up through a function in actions.py. This is where it’s not working. Each number is saved on a slot and I am doing the tracker.get_slot to grab each number onto a variable.

You can find it here from line 67: Rasa/actions.py at main · velorett-i/Rasa · GitHub

How should I proceed?

This chatbot has the purpose of helping war refugees in their hosting country.

edit: I forgot to add that, once the calculation is done, if the total is above 44 RASA should start another story but if it’s below 44 it ends the conversation. How is this achievable?

Thank you!

Hi, there is a lot to unpack in your question. Why do you use an individual forms for every question? I think it would simplify everything, if you use only one form. You can also use der utter_ask_<slot_name> syntax to ask the questions for the slots. This makes the code a lot simpler.

The usage of individual forms is actually complicating things, but my main problem is the actual calculation and returning a different action depending on the sum.

you can add more required slots to a form using custom actions. This extends the form with further questions. This would be my approach.

This way I don’t require such a huge story like the one in line 22, right?

Yes, I think your code could work completely without stories.

Your code is all fine and Can work perfectly also check mine Multiples calculator with steps