Commit d05e6155 by Sai Komuravelli

recruiters updates

parent 7b9b81e8
Showing with 54 additions and 49 deletions
......@@ -47,75 +47,80 @@ class ActionSendSms(Action):
dispatcher.utter_template('utter_sms', tracker)
return []
class Primary_information(FormAction):
print('in Primary_information')
class greet_primary_information(FormAction):
print('in greet_primary_information_form')
def name(self) -> Text:
return "primary_information_form"
return "greet_primary_information_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
intent = tracker.latest_message.get("intent", {}).get("name")
conf = tracker.latest_message.get("intent", {}).get("confidence")
print('querytext',tracker.slots["querytext"])
print('intent',intent)
print('conf',conf)
#if intent == "affirm" :
# if intent == "affirm" and conf>0.4 :
# print("IN from deny")
# #tracker.slots["querytext"] = "no"
return["intentname","confidence","querytext","askques", "email", "mobilenumber", "company","experience", "skills","availabletime"]
# else:
# print("IN from deny1")
# tracker.slots["querytext"] = "no"
# return["availabletime"]
print('tracker.slots',tracker.slots)
print("INTENT")
if intent == "stop" and conf>0.8:
print("INSTOP")
tracker.slots["querytext"] = "stop"
return["querytext"]
else:
return["intentname","confidence","querytext" ,"askques","refferals","refferal_yes_info", "email_mobile", "skills","availabletime"]
def validate_querytext(self,value:Text,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> Dict[Text, Any]:
print("------------------------")
#print(tracker.events)
for each_event in tracker.events[::-1]:
print('1111111')
print("each_event['event']", each_event['event'])
if each_event['event'] == 'user':
print('2222')
print('intent name', tracker.events[-1]['parse_data']['intent']['name'])
if each_event['parse_data']['intent']['name'] == "affirm":
print('33333')
#print(tracker.events[-1]['parse_data']['intent']['name'])
if each_event['parse_data']['intent']['name'] == "greet":
querytext = each_event['text']
intentname = "affirm"
intentname = "greet"
confidence = each_event['parse_data']['intent']['confidence']
print(querytext)
break
print('44444444')
return {"querytext":querytext,"intentname":intentname,"confidence":confidence}
def validate_askques(self,value:Text,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> Dict[Text, Any]:
print('in validate askques')
intentname=tracker.events[-1]['parse_data']['intent']['name']
confidence=tracker.events[-1]['parse_data']['intent']['confidence']
slot_to_fill = value.lower()
print("AAA")
print("askques")
print(slot_to_fill)
print(value)
if slot_to_fill == "yes":
print("-----------YES in kb-----------------")
#print(tracker.get_slot('greathelp'))
return {"email":None, "mobilenumber":None, "company":None,"experience":None, "skills":None,"availabletime":None}
# return {"CREATE_IMPACT":"empty","sysid":"none","kbarticles":"Yes"}
elif slot_to_fill == "no":
print("-----------No-----------------")
# print(tracker.get_slot('submit_ticket'))
return { "email":"none", "mobilenumber":"none", "company":"none","experience":"none", "skills":"none","availabletime":None}
# return {"kbarticles":"No"}
print('in yes askq')
return {"askques":"yes",'email_mobile':None,"intentname":intentname,"confidence":confidence,"refferals":"empty","refferal_yes_info":"None"}
elif slot_to_fill == "no":
print('askques-no')
return {"askques":"no","refferals":None,"intentname":intentname,"confidence":confidence}
else:
print("------------None------------")
return {"askques":None}
def validate_refferals(self,value:Text,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> Dict[Text, Any]:
print('in validate refferals')
slot_to_fill = value.lower()
print("refferals")
print(slot_to_fill)
print(value)
if value.lower() in ['yes','yeah','ha','y']:
print('validate_refferals')
return {"email_mobile":"None", "skills":"None","availabletime":"None"}
elif value.lower() in ['no','No','N']:
print('askques-no')
dispatcher.utter_message(template="utter_refferal_no")
else:
print("------------None------------")
return {"refferals":None}
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"askques": self.from_text(),
"email": self.from_text(),
"mobilenumber": self.from_text(),
"company": self.from_text(),
"experience": self.from_text(),
"email_mobile": self.from_text(),
"skills": self.from_text(),
"availabletime": self.from_text()
"availabletime": self.from_text(),
"refferals":self.from_text(),
"refferal_yes_info":self.from_text()
}
def submit(
......@@ -123,18 +128,18 @@ class Primary_information(FormAction):
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) ->List[Dict]:
# if tracker.get_slot("querytext") != "no":
return []
# else:
# dispatcher.utter_template('utter_slots_datetime', tracker)
# return []
if tracker.get_slot("querytext") != "stop":
return []
else:
dispatcher.utter_template('utter_stop', tracker)
return []
class ResetSlot(Action):
def name(self):
return "action_reset"
def run(self, dispatcher, tracker, domain):
return [SlotSet("email", None), SlotSet("querytext","empty"),SlotSet("intentname","empty"),SlotSet("confidence",None),SlotSet("mobilenumber",None),SlotSet("experience",None), SlotSet("skills",None), SlotSet("askques",None),SlotSet("availabletime",None)]
def run(self, dispatcher, tracker, domain):
return [SlotSet("email_mobile", None), SlotSet("refferals", None), SlotSet("refferal_yes_info", None),SlotSet("intentname","empty"),SlotSet("confidence",None), SlotSet("skills",None), SlotSet("askques",None),SlotSet("availabletime",None),SlotSet("querytext","empty")]
#SlotSet("copeup","empty"),SlotSet("sources","empty"), SlotSet("concern","empty"),SlotSet("pressingconcerns","empty"),SlotSet("items","empty"),SlotSet("purchase","empty"),SlotSet("fmembers","empty"),SlotSet("socialmedia","empty"),SlotSet("assistance","empty"),SlotSet("mobilenumber","empty"),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment