Hello Guys, i have two problem with my code
First i want to use number as a variable for send a POST via API. It works if I use a custom entity (adding to the nlu.md) but it doesn’t work if I use duckling to extract number.
class AskIssueForm(FormAction):
def name(self) -> Text:
return "ask_issue_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
return ["number"]
def submit(self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict]:
id = tracker.get_slot("number")
issue = get(id)
"""Define what the form has to do
after all required slots are filled"""
dispatcher.utter_message(issue.subject)
return [AllSlotsReset()]
If i change “number” for “id”(custom) its works, but only with your own examples, if I try a different number you ask me again.
Second problem is Slot Mapping: if i add the slot mapping function the bot wrongly answers all the questions and the function doesn’t work
@staticmethod def required_slots(tracker: Tracker) → List[Text]: “”“A list of required slots that the form has to fill”“” return [“number”, “PER”, “email”]
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"PER": [self.from_entity(entity="PER")],
"number": [self.from_entity(entity="number"),
"email": [self.from_entity(entity="email")]
}
Thanks You Guys