Similar to the issue described here my bot is running a form and asking questions with buttons retrieved from an external datasource for a subset of the required slots.
As noted in the linked post, I’ve overloaded the request_next_slot
method in the service_form and interactive training goes as planned; however, when the bot runs it loops through the action associated with the first slot using custom buttons 10x (thus tripping the circuit breaker
before finally returning the response with buttons and waits for the user button input (action_listen
).
After all entities are filled it loops through the list of entities set by buttons from user input once more before completing the story successfully.
I’ve tried this with a mostly bare stories file and get the same results.
Referring to the overloaded function below; is this done correctly?
def request_next_slot(
self,
dispatcher, # type: CollectingDispatcher
tracker, # type: Tracker
domain, # type: Dict[Text, Any]
):
# type: … -> Optional[List[Dict]]
"""Request the next slot and utter template if needed,
else return None"""
for slot in self.required_slots(tracker):
if self._should_request_slot(tracker, slot):
logger.debug("Request next slot '{}'".format(slot))
if slot == "service":
return[SlotSet(REQUESTED_SLOT, slot), FollowupAction("action_button_service")]
elif slot == "host":
return[SlotSet(REQUESTED_SLOT, slot), FollowupAction("action_button_host")]
else:
dispatcher.utter_template(
"utter_ask_{}".format(slot),
tracker,
silent_fail=False,
**tracker.slots
)
return [SlotSet(REQUESTED_SLOT, slot)]
# no more required slots to fill
return None