I am trying to create a bot. The expected behaviour is:
User : Hi
Bot will Gives the suggestions
User : Choses one of them
Bot will ask for user id
User : Enters user id
Bot will give the information
User : Says thanks
Bot replies with ending message.
But I am getting an unexpected results. I am giving the actual terminal output.
Please Provide Your Employee id
Your input -> 45222
ANNOUNCEMENTS_LINK
Your input -> thanks
ANNOUNCEMENTS_LINK
Your input -> thanks
Have a good day.
So whenever I give thanks again the result of previous intent is shown i.e when I write thanks for the first time it instead of giving an ending message again gives the ANNOUNCEMENTS_LINK. It is after the second time I wrote thanks that it gave the correct reply.
My NLU File:\
## intent:provide_id
- [77897] (username)
- My id is [98239] (username)
- [12345] (username)
## intent:info
- i need some information
- i want to see [announcements] (info_type)
- i want to see various [circulars] (info_type)
- i want to see important [links] (info_type)
- i want my [entitlements] (info_type)
- i want to know about my pending [claims] (info_type)
## intent:greet
- Hi
- Hey
- Hi bot
- Hey bot
- Hello
- good morning
- hi again
- hi folks
- hi Mister
- hi pal!
- hi there
- greetings
- hello everybody
- hello is anybody there
- hello robot
- hi
## intent:goodbye
- Bye
- Bye!
- Goodbye
- See you later
- Bye bot
- Goodbye friend
- bye
- bye for now
- catch you later
- gotta go
- See you
- goodnight
- have a nice day
- i'm off
- see you later alligator
- we'll speak soon
## intent:affirm
- yes
- indeed
- of course
- that sounds good
- correct
- yes sure
- absolutely
- for sure
- yes yes yes
- definitely
- yeah
- si
- ok
- okay
## intent:deny
- no
- never
- I don't think so
- don't like that
- no way
- not really
## intent:mood_great
- perfect
- very good
- great
- amazing
- wonderful
- I am feeling very good
- I am great
- I'm good
## intent:mood_unhappy
- sad
- very sad
- unhappy
- bad
- very bad
- awful
- terrible
- not very good
- extremely sad
- so sad
## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
## intent:thanks
- Thanks
- Thank you
- Thank you so much
- Thanks bot
- Thanks for that
- cheers
- cheers bro
- ok thanks!
- perfect thank you
- thanks a bunch for everything
- thanks for the help
- thanks a lot
- amazing, thanks
- cool, thanks
- cool thank you
## regex:username
- [0-9]{5}
**DOMAIN FILE:**
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- info
- thanks
- provide_id
actions:
- action_find_info
entities:
- info_type
- username
slots:
info_type:
type: unfeaturized
username:
type: unfeaturized
responses:
utter_greet:
- text: "Hey! How may I assist You?"
buttons:
- title : "Announcements"
payload : '/info{"info_type":"Announcements"}'
- title : "Circulars"
payload : '/info{"info_type":"Circulars"}'
- title : "Important Links"
payload : '/info{"info_type":"Important Links"}'
- title : "Entitlements"
payload : '/info{"info_type":"Entitlements"}'
- title : "Pending Claims"
payload : '/info{"info_type":"Pending Claims"}'
utter_cheer_up:
- text: "Here is something to cheer you up:"
image: "https://i.imgur.com/nGF1K8f.jpg"
utter_did_that_help:
- text: "Did that help you?"
utter_happy:
- text: "Great, carry on!"
utter_goodbye:
- text: "Talk to you later!"
- text: "Have a good day."
- text: "Until next time!"
utter_thanks:
- text: "My pleasure."
- text: "You are welcome!"
utter_iamabot:
- text: "I am a bot, powered by Rasa."
utter_provide_id:
- text: "Please Provide Your Employee id"
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: true
Actions File:
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet
class ActionFindInfo(Action):
def name(self) -> Text:
return "action_find_info"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
infot = tracker.get_slot("info_type")
user = tracker.get_slot("username")
print("info=",infot)
output = ""
if infot == "Announcements":
output = "ANNOUNCEMENTS_LINK"
elif infot == "Circulars":
output = "CIRCULAR_LINK"
elif infot == "Important Links":
output = "IMPORTANT_LINK"
elif infot == "Entitlements":
output = "Username = {}".format(user)
elif infot == "Pending Claims":
output = "Username = {}".format(user)
dispatcher.utter_message(output)
return []
**Stories:**
## happy path
* greet
- utter_greet
* info{"info_type":"announcements"}
- utter_provide_id
* provide_id
- action_find_info
* thanks
- utter_thanks
## happy path 2
* info{"info_type":"announcements"}
- utter_provide_id
* provide_id
- action_find_info
* thanks
- utter_thanks
## sad path 1
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* affirm
- utter_happy
## sad path 2
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* deny
- utter_goodbye
## say goodbye
* goodbye
- utter_goodbye
## bot challenge
* bot_challenge
- utter_iamabot
Please help !!