def run(self, dispatcher, tracker, domain): current = "action_q2f" last_intent = tracker.latest_message['intent'].get('name') last_message = tracker.latest_message['text'] if (last_message == "yes") or (last_intent == "affirm"): #dispatcher.utter_message("Do you have any tie-ups with Swiggy, UberEats, Zomato etc. Please specify.") counter = "action_end" education = "IIT-IIM" return [ SlotSet('current', current), SlotSet('counter', counter), FollowupAction(counter), SlotSet('education', education) ] elif (last_message == "no") or (last_intent == "deny"): counter = "action_stop" education = 'Uneducated' return [ SlotSet('current', current), SlotSet('counter', counter), FollowupAction(counter), SlotSet('education', education) ] else: dispatcher.utter_message( "Please be a little more clear, I'll ask again!") counter = "action_q2" return [ SlotSet('current', current), SlotSet('counter', counter), FollowupAction(counter) ]
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: #policy treshold on the choice of the announcements TRESHOLD = 0.8 query = tracker.latest_message["text"] if query != None: msg = "Questi sono i risultati della tua ricerca" # (query: " + query + "):" dispatcher.utter_message(msg) #get all the results results = searchDocuments(query, self.announcements, self.dictionary, self.model) #compute maximum for normalization maxSimilarity = 0 for r in results: if r["similarity"] > maxSimilarity: maxSimilarity = r["similarity"] #choose only the best matchs, and never more than 5. #Take less than 5 if the first result has 30% #more confidence than the second, or if the second result has 25% more confidence than the third and so on limit = 5 for i in range(min(len(results), limit) - 1): if (results[i]["similarity"] / maxSimilarity) > TRESHOLD: limit = i + 1 #format announcements for result in results[:limit]: #msg = result["title"] + " (" + str(result["similarity"]) + "): " + result["url"] msg = result["title"] + ": " + result[ "url"] + " sim: " + result["url"] + "norm" + str( result["similarity"] / maxSimilarity) dispatcher.utter_message(msg) return [FollowupAction("action_listen")]
def run(self, dispatcher, tracker, domain): first_name = tracker.get_slot("first_name") last_name = tracker.get_slot("last_name") dispatcher.utter_message( "Hello {} {}, How are you? For a sample of my work I can show you how to make a transpose of a 3X3 matrix." .format(first_name, last_name)) return [FollowupAction("utter_firstrow")]
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict]: """Define what the form has to do after all required slots are filled""" # utter submit template dispatcher.utter_template('utter_submit', tracker) return [FollowupAction('find_facilities')]
def submit(self, dispatcher, tracker, domain): # type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict] """Define what the form has to do after all required slots are filled""" # utter submit template dispatcher.utter_template('utter_submit', tracker) return [FollowupAction('find_hospital')]
def run(self, dispatcher, tracker, domain): srn = tracker.get_slot("SRN") if srn is None: dispatcher.utter_message("Please provide your SRN Value.") return [FollowupAction("action_listen")] else: srn = srn.lower() if srn[0] == 'r' and 13 <= int(srn[1:3]) <= 19 and 0 <= int( srn[-3:-2]) <= 9 and 0 <= int( srn[-2:-1]) <= 9 and 1 <= int( srn[-1:]) <= 9 and srn[3:-3] in [ 'cs', 'me', 'cv', 'eee', 'ec' ]: return [FollowupAction("action_getAttendance")] else: dispatcher.utter_message( "Please provide your correct SRN Value.") return [FollowupAction("action_listen")]
def run(self, dispatcher, tracker, domain): user_name = tracker.get_slot("user_name").split()[0] dispatcher.utter_message( "Thanks for your support {}.\n Goodbye!! ".format(user_name)) counter = "action_end" current = "action_end" return [ SlotSet('counter', counter), FollowupAction("action_restart"), SlotSet('current', current) ]
def run(self, dispatcher, tracker, domain): #user_name= tracker.get_slot("user_name") dispatcher.utter_template("utter_stop_check", tracker) #ActionSave.run('action_save',dispatcher, tracker, domain) counter = tracker.get_slot("current") current = "action_stop_check" return [ FollowupAction("action_listen"), SlotSet('current', current), SlotSet('counter', counter) ]
def run(self, dispatcher, tracker, domain): user_name = tracker.get_slot("user_name").split()[0] dispatcher.utter_message( "Can't help you no more {}.\nWell t'was nice meeting you buddy. Goodbye!! " .format(user_name)) counter = "action_stop" current = "action_stop" return [ SlotSet('counter', counter), FollowupAction("action_restart"), SlotSet('current', current) ]
def run(self, dispatcher, tracker, domain): counter = 'action_interview_start' current = "action_interview_start" user_name = tracker.get_slot('user_name') user_cell = tracker.get_slot('user_cell') logger.info("action_interview_start") if (user_name == "Dear" and user_cell == "none"): #dispatcher.utter_message("PD शुरू करने के लिए कृपया रेफरेंस आईडी इनपुट करें, डेमो के लिए 12345 इनपुट करें।") dispatcher.utter_message( "To start, kindly input your yobo id!.Pres 12345 if you don't have a yobo id!" ) return [ FollowupAction("action_listen"), SlotSet('counter', counter), SlotSet('current', current) ] else: dispatcher.utter_message("Continue plz.") return [FollowupAction("action_default_fallback")]
def run(self, dispatcher, tracker, domain): try: intent_name = tracker.latest_message['intent'].get('name') if FORM_NAME: return [FollowupAction(FORM_NAME)] else: res = res_df.loc[res_df['Intent'] == intent_name].iloc[:, 1] dispatcher.utter_message(res.item()) if intent_name == 'prevention': dispatcher.utter_message(template='utter_cheer_up') except: dispatcher.utter_message("Something went wrong!") return []
def run(self, dispatcher, tracker, domain): symptom = tracker.get_slot('symptom') host = get_ts_host() res = requests.post(host, json=triage_request(symptom)) specialty = json.loads(res.json())[symptom][0][0] # include code to include specialty slot print(specialty) return [ SlotSet("specialty", specialty), SlotSet("location", "nearby"), SlotSet("facility_type", "c8qv-268j"), FollowupAction('find_facilities') ]
def run(self, dispatcher, tracker, domain): age_string = tracker.latest_message['text'] age = re.findall('\d+', age_string) if age_string.isdigit() is True: return [ SlotSet("age", age_string), FollowupAction("action_registration") ] else: if isinstance(age, int) is True: age = int(age[0]) return [ SlotSet("age", age), FollowupAction("action_registration") ] else: dispatcher.utter_message( "I couldn't quite get how that response can be your age :/ Please enter your valid age." ) return [ SlotSet("validation", "invalid"), FollowupAction("action_listen") ]
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List['Event']: # Fallback caused by TwoStageFallbackPolicy if (len(tracker.events) >= 4 and tracker.events[-4].get('name') == 'action_default_ask_affirmation'): return [ SlotSet('feedback_value', 'negative'), Form('feedback_form'), FollowupAction('feedback_form') ] # Fallback caused by Core else: dispatcher.utter_template('utter_default', tracker) return [UserUtteranceReverted()]
def run(self, dispatcher, tracker, domain): current = "action_q1" user_name = tracker.get_slot("user_name").split()[0] #dispatcher.utter_message("{}. Goodbye!! ".format(user_name)) buttons = [{ 'title': 'Yes', 'payload': 'yes' }, { 'title': 'No', 'payload': 'no' }] dispatcher.utter_button_message( "Do you earn more than 15 lacks per annum?", buttons) counter = "action_q1f" return [ SlotSet('counter', counter), FollowupAction("action_listen"), SlotSet('current', current) ]
def run(self, dispatcher, tracker, domain): config = {"user_key": "f4924dc9ad672ee8c4f8c84743301af5"} zomato = zomatopy.initialize_app(config) loc = tracker.get_slot('location') city = str(loc) if city.lower() in allowed_cities: return [SlotSet('location_match', "one")] else: zomato = zomatopy.initialize_app(config) # return [SlotSet('location_match',"zero")] try: results = zomato.get_city_ID(city) return [SlotSet('location_match', "one")] except: # dispatcher.utter_template(, tracker) return [ SlotSet('location_match', "zero"), FollowupAction("utter_sorry_dont_operate") ]
def run(self, dispatcher, tracker, domain): current = "action_q2" user_name = tracker.get_slot("user_name").split()[0] #dispatcher.utter_message("{}. Goodbye!! ".format(user_name)) buttons = [{ 'title': 'Yes', 'payload': 'yes' }, { 'title': 'No', 'payload': 'no' }] dispatcher.utter_button_message( "Have you studies from one of the IIts or the IIMs?", buttons) counter = "action_q2f" return [ SlotSet('counter', counter), FollowupAction("action_listen"), SlotSet('current', current) ]
def run(self, dispatcher, tracker, domain): try: entity_name = None entity_val = None user_dict = dict() ent_nm = tracker.latest_message['entities'] user_nm = tracker.get_slot('person') user_st = tracker.get_slot('state') phone = tracker.get_slot('phone') pin = tracker.get_slot('pin') email = tracker.get_slot('email') user_dict['name'], user_dict['contact'], user_dict[ 'pin'], user_dict['email'] = user_nm, phone, pin, email if ent_nm: entity_name = ent_nm[0]['entity'] entity_val = ent_nm[0]['value'] #validating user information if user_nm and phone and pin and email: dispatcher.utter_message( f"Hi {user_nm.title()} 🙋♂️. Thank you for using COVID-19 helpline. We have send across a mail Regarding COVID safety tips and daily COVID reports.Stay safe :)" ) if tracker.get_slot('country') != 's': self.db_user_insert(user_dict) #self.send_mail(email) return [SlotSet('country', 's')] else: if entity_name == 'PERSON' and not user_nm: dispatcher.utter_message( f"Hi {entity_val.title()} 🙋♂️.Please enter your contact number 📱" ) return [ SlotSet('state', entity_val), SlotSet('person', entity_val) ] elif entity_name == 'phone' or (user_nm and not phone): if not phone: dispatcher.utter_message( f"contact number 📱 doesn't look correct !") dispatcher.utter_message( f"Hi {user_nm.title()} 🙋♂️.Please enter your contact number 📱" ) return [] else: dispatcher.utter_message(f"Please enter PIN CODE") return SlotSet('phone', entity_val) elif entity_name == 'pin' or (phone and not pin): if not pin: dispatcher.utter_message( f"not able to process the pin code !") dispatcher.utter_message(f"Please enter your PIN CODE") return [] else: dispatcher.utter_message(f"Please enter Email address") return SlotSet('pin', entity_val) elif entity_name == 'email' or (pin and not email): if not email: dispatcher.utter_message( f"Unable to process the email id!") dispatcher.utter_message(f"please enter your Email id") return [] else: return [ SlotSet('email', entity_val), FollowupAction('fetch_info') ] else: if not user_nm: dispatcher.utter_message("Please enter your Full name") else: dispatcher.utter_message( "something went wrong.Let try again") ent_nm = {} return [FollowupAction('fetch_info')] except: dispatcher.utter_message( "I am sorry i was not able to understand you correctly") return []
def run(self, dispatcher, tracker, domain): dispatcher.utter_message("Congratulations! Registration Successful.") return [FollowupAction("action_work")]
def run(self, dispatcher, tracker, domain): counter = tracker.get_slot('counter') current = tracker.get_slot('current') interview_state = tracker.get_slot("interview_state") last_intent = tracker.latest_message['intent'].get('name') last_intent1 = tracker.latest_message['intent'] last_message = tracker.latest_message['text'] user_name = tracker.get_slot("user_name") logger.info("action_default") logger.info(current) logger.info(counter) logger.info(last_intent1) logger.info(last_message) #before interview start #interview state turns to "started if details are fetched in action fetch details" if interview_state == "start": last_intent = tracker.latest_message['intent'].get('name') if last_intent == "greet": dispatcher.utter_message("Hi, its a strt. How are you!!") counter = "action_interview_start" return [FollowupAction(counter)] #elif counter !="action_interview_start": elif last_intent in [ "chitchat", "greet", "thank", "weather", "abuse" ]: ret = "utter_{}".format(last_intent) try: dispatcher.utter_template(ret, tracker) dispatcher.utter_message("Lets start again, how are you!!") except: dispatcher.utter_message( "Do i know u?Lets start again, how are you!!") counter = "action_listen" return [FollowupAction(counter)] #interview starter if current == counter == "action_interview_start" and interview_state == "start": counter = "action_fetch_details" return [FollowupAction(counter)] #after interview start if interview_state == "started": #check for intents that are out of scope for interview! #in these we followup with the same question #blank reply if len(last_message) == 0: dispatcher.utter_message("No Blanks!!, again!!") return [FollowupAction(current)] #repeat if (last_intent == "repeat") or (last_message == "what") or ( last_message == "क्या") or (last_message == "रिपीट"): dispatcher.utter_message("मै फिर पूछूँगी.") return [FollowupAction(current)] #chitchat if last_intent in [ "chitchat", "greet", "thank", "weather", "abuse", "ask_name", "tell_name" ]: ret = "utter_{}".format(last_intent) #dispatcher.utter_message("This is an interview, ill ask again!!") dispatcher.utter_template(ret, tracker) return [FollowupAction(current)] #goodbye if last_intent == "goodbye": #dispatcher.utter_message("Goodbye {}".format(user_name)) #counter="action_stop_check" return [FollowupAction("action_stop_check")] #staring the interview with 12345 if current == "action_fetch_details": user_name = last_message return [ FollowupAction(counter), SlotSet('user_name', user_name) ] #stop if (last_message == "stop") or (last_intent == "stop") or (last_message == "स्टॉप"): #dispatcher.utter_message("Goodbye {}".format(user_name)) #counter="action_stop_check" return [FollowupAction("action_stop_check")] if current == "action_stop_check": if last_intent == "affirm" or (last_message == "हां") or (last_message == "हाँ"): counter = "action_stop" return [ FollowupAction(counter), SlotSet('interview_state', "aborted") ] else: dispatcher.utter_message("हम PD जारी रखेंगे।") #will use the same current and ask again. #note thatw e have put the current in counter in action_stop_check for a recall. return [FollowupAction(counter)] if counter == "end": dispatcher.utter_message("आपके समय के लिए धन्यवाद!") return [ FollowupAction("action_stop"), SlotSet('interview_state', "Finished") ] return [FollowupAction(counter)]
def run(self, dispatcher, tracker, domain): gender = tracker.latest_message['text'] dispatcher.utter_message("May I know your age?") return [SlotSet("gender", gender), FollowupAction("action_listen")]
def run(self, dispatcher, tracker, domain): last_name = tracker.latest_message['text'] return [ SlotSet("last_name", last_name), FollowupAction("utter_gender") ]
def run(self, dispatcher, tracker, domain): first_name = tracker.latest_message['text'] return [ SlotSet("first_name", first_name), FollowupAction("utter_lastname") ]
def run(self, dispatcher, tracker, domain): third_row = tracker.latest_message['text'] return [ SlotSet("third_row", third_row), FollowupAction("action_transpose_matrix") ]
def run(self, dispatcher, tracker, domain): second_row = tracker.latest_message['text'] return [ SlotSet("second_row", second_row), FollowupAction("utter_thirdrow") ]
def run(self, dispatcher, tracker, domain): #this_action='action_interview_start' user_name = tracker.get_slot('user_name') user_cell = tracker.get_slot('user_cell') last_message = tracker.latest_message['text'] logger.info("action_fetch_details") try: n = 0 for i in last_message.split(): #if i in df['applicant_1_phone'].fillna(0).astype(int).astype(str).values.tolist(): if i.isdigit(): user_cell = i #i = 1024639 try: json_response = get_final_data(int(i)) #extract data from DB using this id and put it in "json_response" json_response = get_final_data(int(i)) except: dispatcher.utter_message("No DB connectivity") n += 1 if (user_name == "Dear" and user_cell == "12345"): dispatcher.utter_message("Please type in your name!") return [ FollowupAction('action_listen'), SlotSet('user_cell', user_cell), SlotSet('interview_state', "started"), SlotSet('current', "action_fetch_details"), SlotSet('counter', "action_q1") ] if n > 1: dispatcher.utter_message( "1 से अधिक सेल की पहचान !. कृपया रजिस्टर्ड सेल नंबर डालिए") user_cell = 'none' return [FollowupAction('action_interview_start')] elif n == 1 and str( json_response["applicant_1_first_name"]) != 'None': #"second change, extracting name"#applicant_1_first_name #user_name=str(df[df.applicant_1_phone==int(user_cell)].last_name.item()) try: translator = Translator() translations = translator.translate( [str(json_response["applicant_1_first_name"])], dest='hi') for translation in translations: user_name = translation.text + " जी" except: user_name = str(json_response["applicant_1_first_name"] + " जी") dispatcher.utter_message( "नमस्ते {},एसएमई कॉर्नर पीडी में आपका स्वागत है। इस बातचीत के दौरान मैं आपसे व्यक्तिगत, सिबिल और बैंकिंग जानकारी के कुछ प्रश्न पूछूंगी। इसमें 15 मिनट से ज्यादा का समय नहीं लगेगा। अब हम पीडी शुरू करेंगे!" .format(user_name)) #return[SlotSet('user_name', user_name),SlotSet('user_cell', user_cell)] #from rasa_core_sdk.events import FollowupAction return [ FollowupAction('action_business_kind'), SlotSet('interview_state', "started"), SlotSet('user_name', user_name), SlotSet('user_cell', user_cell), SlotSet('json_response', json_response) ] else: dispatcher.utter_message( "रेफरेंस आईडी रजिस्टर्ड नहीं है। कृपया रजिस्टर्ड आईडी इनपुट करें या अपने इंटरव्यू को पुनर्निर्धारित करने के लिए SMEcorner हेल्पडेस्क से संपर्क करें। धन्यवाद!" ) return [FollowupAction('action_interview_start')] except: dispatcher.utter_message( "रेफरेंस आईडी रजिस्टर्ड नहीं है। कृपया रजिस्टर्ड आईडी इनपुट करें या अपने इंटरव्यू को पुनर्निर्धारित करने के लिए SMEcorner हेल्पडेस्क से संपर्क करें। धन्यवाद!" ) return [FollowupAction('action_interview_start')]
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict]: """Define what the form has to do after all required slots are filled""" #type of degrees lookupTableTypeDegree = dict({ "t": "triennale", "m": "magistrale", "cu": "magistrale a ciclo unico" }) #input degree = tracker.get_slot("corso") type_degree = tracker.get_slot("tipo_laurea") type_info = tracker.get_slot("tipo_info") exam = tracker.get_slot("insegnamento") degree = degree.lower() #load data with open('CampusDegrees.json') as json_file: degrees = json.load(json_file) #check type degree and eventually set default value if type_degree == "triennale": type_degree = "t" elif type_degree == "magistrale": type_degree = "m" elif type_degree == "magistrale a ciclo unico": type_degree = "cu" else: if "t" in degrees[degree]: type_degree = "t" elif "m" in degrees[degree]: type_degree = "m" else: type_degree = "cu" #check type info and send response msg = "" if exam != None: for e in degrees[degree][type_degree]["insegnamenti"]: if exam in e["nome"]: msg = "Ecco la scheda di " + e["nome"] + ": " + e[ "url"] + "." elif type_info != None: if type_info == "piano didattico": msg = "Ecco il piano didattico del corso di laurea " + lookupTableTypeDegree[ type_degree] + " in " + degree + ": " + degrees[degree][ type_degree]["piano_studi"] + "." elif type_info == "appelli": msg = "Ecco gli appelli d'esame del corso di laurea " + lookupTableTypeDegree[ type_degree] + " in " + degree + ": " + degrees[degree][ type_degree]["esami"] + "." elif type_info == "calendario": msg = "Ecco il calendario didattico del corso di laurea " + lookupTableTypeDegree[ type_degree] + " in " + degree + ": " + degrees[degree][ type_degree]["calendario"] + "." elif type_info == "orario": msg = "Ecco l'orario delle lezioni del corso di laurea " + lookupTableTypeDegree[ type_degree] + " in " + degree + ": " + degrees[degree][ type_degree]["orario"] + "." if msg == "": msg = "Ecco la scheda del corso di laurea " + lookupTableTypeDegree[ type_degree] + " in " + degree + ": " + degrees[degree][ type_degree]["url"] + "." SlotSet("tipo_info", None) SlotSet("insegnamento", None) dispatcher.utter_message(msg) return [FollowupAction("action_listen")]
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List['Event']: dispatcher.utter_template('utter_thanks_for_feedback', tracker) dispatcher.utter_template('utter_restart_with_button', tracker) return [FollowupAction('action_listen')]
def run(self, dispatcher, tracker, domain): counter = tracker.get_slot('counter') current = tracker.get_slot('current') bkind = tracker.get_slot("bkind") nob = tracker.get_slot("nob") industry = tracker.get_slot("industry") interview_state = tracker.get_slot("interview_state") last_intent = tracker.latest_message['intent'].get('name') last_message = tracker.latest_message['text'] last_message = last_message.lower() user_name = tracker.get_slot("user_name") digits = [i for i in re.findall('\d+', last_message)] date = next(tracker.get_latest_entity_values("DATE"), None) cardinal = next(tracker.get_latest_entity_values("CARDINAL"), None) #dispatcher.utter_message(current) #dispatcher.utter_message(counter) #dispatcher.utter_message(last_intent) #json_response= tracker.get_slot("json_response") #dispatcher.utter_message(json_response) #before interview start #interview state turns to "started if details are fetched in action fetch details" if interview_state == "start": if last_intent == "greet": dispatcher.utter_message( "अब हम पीडी शुरू करने के लिए आगे बढ़ेंगे। यदि आप किसी भी समय इंटरव्यू से बाहर निकलना चाहते हैं, तो 'stop' इनपुट करें." ) counter = "action_interview_start" return [FollowupAction(counter)] elif counter != "action_interview_start": dispatcher.utter_message( "शुरू करने के लिए कृपया 'Hi' इनपुट करें.") counter = "action_listen" return [FollowupAction(counter)] #interview starter if current == counter == "action_interview_start": counter = "action_fetch_details" return [FollowupAction(counter)] #after interview start if interview_state == "started": #check for intents that are out of scope for interview! #in these we followup with the same question #blank reply if len(last_message) == 0: dispatcher.utter_message( "कृपया उत्तर को खाली न छोड़ें, मैं फिर पूछूंगा.") return [FollowupAction(current)] #repeat if (last_intent == "repeat") or (last_message == "what"): dispatcher.utter_message("मैं फिर पूछूंगा.") return [FollowupAction(current)] #chitchat if last_intent == "chitchat": #dispatcher.utter_message("This is an interview, ill ask again!!") dispatcher.utter_template("utter_chitchat", tracker) return [FollowupAction(current)] #greet if last_intent == "greet": #dispatcher.utter_message("This is an interview, ill ask again!!") dispatcher.utter_template("utter_greet", tracker) return [FollowupAction(current)] #thank if last_intent == "thank": dispatcher.utter_template("utter_thanks", tracker) return [FollowupAction(current)] #goodbye if last_intent == "goodbye": #dispatcher.utter_message("Goodbye {}".format(user_name)) #counter="action_stop_check" return [FollowupAction("action_stop_check")] #staring the interview with 12345 if current == "action_fetch_details": user_name = last_message return [ FollowupAction(counter), SlotSet('user_name', user_name) ] #stop if (last_message == "stop") or (last_intent == "stop"): #dispatcher.utter_message("Goodbye {}".format(user_name)) #counter="action_stop_check" return [FollowupAction("action_stop_check")] if current == "action_stop_check": if last_intent == "affirm": counter = "action_stop" else: dispatcher.utter_message("हम PD जारी रखेंगे।") #will use the same current and ask again. #note thatw e have put the current in counter in action_stop_check for a recall. return [FollowupAction(counter)] #business kind if current == "action_business_kind": if (last_intent == "pvt") or (last_message == "private"): #dispatcher.utter_message("Got it u meant private!") counter = "action_private" bkind = "private" elif (last_intent == "public") or (last_message == "public"): #dispatcher.utter_message("Got it u meant public!") counter = "action_public" bkind = "public" elif (last_intent == "prop") or (last_message == "prop"): #dispatcher.utter_message("Got it u meant proprietery!") counter = "action_business_years" bkind = "prop" elif (last_intent == "partnership") or (last_message == "partnership"): #dispatcher.utter_message("Got it u meant partnership!") counter = "action_partner" bkind = "partnership" else: dispatcher.utter_message("Not understood!") counter = "action_business_kind" return [FollowupAction(counter), SlotSet('bkind', bkind)] #Nature of business!! if current == "action_nob": if (last_intent == "manufacturing") or (last_message == "manufacturing"): #dispatcher.utter_message("Manufacturing!") nob = "manu" #counter= "action_industry_followup" return [FollowupAction(counter), SlotSet('nob', nob)] #counter= "action_manu_loc" elif (last_intent == "SP") or (last_message == "SP"): dispatcher.utter_message("सर्विस प्रोवाइडर!") nob = "sp" #counter= "action_industry_followup" return [FollowupAction(counter), SlotSet('nob', nob)] #counter= "action_sp_order" elif (last_intent == "trader") or (last_message == "trader"): dispatcher.utter_message("Trader!") nob = "trader" #counter= "action_industry_followup" return [FollowupAction(counter), SlotSet('nob', nob)] #counter= "action_trader" else: dispatcher.utter_message("कृपया जवाब दें!") dispatcher.utter_template("utter_ask_nob", tracker) return [FollowupAction("action_listen")] if counter == "end": dispatcher.utter_message("आपके समय के लिए धन्यवाद!") return [FollowupAction("action_stop")] return [FollowupAction(counter)]