High level description.
A validation function in a form action seemingly assigns the slot value as expected. However, when the slot is checked later on in another validation function, the value is not updated. Kind of similar to this one but no actual solution is mentioned there. The issue seems to be that the tracker is not updated ‘on the run’. I wonder what the recommended solution would be.
Let say I have a FormAction with 3 required slots X, Y, Z (in that order).
I have validation functions for all 3 of them.
All 3 validation functions behave as expected if I walk the chatbot through the form action one by one, in other words - if the conversation looks something like this:
Start my form action
Question for X
Answer for X
Question for Y
Answer for Y
Answer for Z
However, if I do something like this:
Start my form actions with values X, Y, Z
The bot fails in a strange way.
From debugging I can tell you the following:
X, Y, Z are extracted and assigned to their appropriate slots.
The validation functions are called in the correct order (X. Y. Z) for all 3 of them.
If I issue a print statement in the function for X(the 1st one called) it looks like the validation function is executed and the value for slot X is reassigned appropriately to the tracker’s current slot values. I have even done this manually by getting and setting the value in the validation function.
However, when validation function for Y is called(after the validation for X was called), the slot for X is still the value that was inputted by the user i.e. not the one assigned by the validation function. Since I depend on a chain logic, as in, validation of Y depends on the validation of X, this causes an application bug.
The issue persists regardless of whether there is a tracker db.
A not so good solution I can think of is to hold a copycat (of the tracker) object in the form action and access the values from there on the run.
A much nicer solution would be if I could manually call an update_slots(slot_value=value) method on the tracker and force update it during validation. Unless I am missing something, I can’t see it here.
Unless there is some good reason for it, it would be even nicer if the tracker got automatically updated on the fly without the user having to call anything on it.