class Actionreportproduct(Action):
def name(self) -> Text:
return "action_report_product"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
ftime = next(tracker.get_latest_entity_values(entity_type = "time", entity_role = "from"),tracker.get_slot("time")) or None
ttime = next(tracker.get_latest_entity_values(entity_type = "time", entity_role = "to"),tracker.get_slot("time")) or None
time = next(tracker.get_latest_entity_values("time"),tracker.get_slot("time")) or None
# Product value stored here
product = next(tracker.get_latest_entity_values("products"),tracker.get_slot("products")) or None
#s_product = tracker.get_slot("products")
# Which Report user want will stored here
report_type = next(tracker.get_latest_entity_values("type"),tracker.get_slot("type")) or None
utter_type = "You selected {} report".format(report_type)
utter_f_t_time = "Your reports are be calculated from {} to {}".format(ftime,ttime)
utter_time = "Your reports are calculate on this {} period".format(time)
def productfunc():
if product:
reply = "Your {} report on {} product on {} will be displayed here". Format(report_type if report_type else "Every", product if product else "all", "from {} to {}".format(ftime,ttime) if ftime and ttime else time if time else "all time")
dispatcher.utter_message(text=reply)
else:
dispatcher.utter_message(text = "Provide some product name to show report on specific product")
productfunc()
return []
here is my custom action
Your input → show me coke and pepsi report ? Is the intent ‘product’ correct for ‘show me [coke][{“entity”: “products”}, {“entity”: “products”}] and [pepsi][{“ent ity”: “products”}, {“entity”: “products”}] report’ and are all entities labeled correctly? Yes
two entity are regognized
but in the output why only one entity is show
Your Every report on coke product on all time will be displayed here
what i want is (Your Every report on coke and pepsi product on all time will be displayed here)
do i need to add something for showing multiple entities in same output