my intent
## intent:check_asana
- check asana for [jobs on linkedin](task_name)
- check asana for [job interviews](task_name)
- check asana for [new opportunities](task_name)
- check asana for [something](task_name)
- check asana
stories
## check_asana
* check_asana
- utter_greet
- utter_goodbye
- asana_enq_form
- form{"name": "asana_enq_form"}
- form{"name": null}
my class
class checkasana(FormAction):
def name(self) -> Text:
return "asana_enq_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
return ['task_enquiry','select_task','length_of_tasks','noteby_user','note_sentiment']
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {'task_enquiry': [self.from_entity(entity="task_name"),],
'select_task':[self.from_text(),],
'noteby_user':[self.from_text(),],}
def submit(self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]
) -> List[Dict]:
"""Once required slots are filled, print buttons for found facilities"""
dispatcher.utter_message(f'''In submit''')
return [AllSlotsReset()]
def validate_task_enquiry(self, value, dispatcher, tracker, domain):
"""Check to see if an task entity was actually picked up by duckling."""
# task_name = tracker.get_slot('task_enquiry')
# tasks = list_tasks(task_name)
tasks = ['hi','get']
ent = tracker.latest_message['entities']
print(ent)
print(value)
if len(tasks) == 0:
#set remaining all slots and validate
return [{"task_enquiry": None}]
if len(tasks) == 1:
#set remaining all slots and validate
return {"length_of_tasks":"single","task_enquiry": value}
if len(tasks) > 1:
print("here")
response_text=""
count = 1
for i in tasks:
response_text = f'''{response_text} \n{count}. {i}'''
count = count+1
dispatcher.utter_message(f'''{response_text}''')
return {"length_of_tasks":"multi","task_enquiry": value}
#set slots and return
def validate_noteby_user(self, value, dispatcher, tracker, domain):
noteby_user = tracker.get_slot('noteby_user')
fail_phrases = ['fail', 'failed', 'failure', 'didn\'t work']
success_phrases = ['succeeded', 'success']
checkPresence = lambda mylist,s : len([each for each in mylist if each.lower() in s.lower()])>=1
if(checkPresence(success_phrases,noteby_user)):
return [SlotSet("note_sentiment", "Success")]
elif(checkPresence(fail_phrases,noteby_user)):
return [SlotSet("note_sentiment", "Failure")]
else:
return [SlotSet("note_sentiment", "Unkown")]
so when the flow goes into story it needs to automatically grab slot from this ‘task_enquiry’: [self.from_entity(entity=“task_name”),
and then go into validate_task_enquiry function, but nothing happens can some tell me reason ?