I’m building a bot that recognizes tasks in a to-do list. When I get the bot to ask for the name of a task, it misinterprets some of the names of the tasks as other intents, such as thinking “job” as the “goodbye” intent. Either way, I’ve set up the Rules to automatically call a sequence of actions, yet it’s not recognizing this sequence, even when I use Rasa interactive to change the intent to “inform”. I’ve included my code below.
The way I want it to work is the bots asks ‘which tasks?’. It listens for the task name, which triggers an action to check the asana database, which returns a list of enumerated task names. the User then gives a number, which triggers the next action (AsanaSelect) with the appropriate name.
What am I doing wrong? I appreciate any help!
Actions:
class CheckAsana(Action):
def name(self) -> Text:
print ('check asana invoked')
return "check_asana_action"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
text_of_last_user_message = tracker.latest_message.get("text")
tasklist = list_tasks_numbered_names(text_of_last_user_message)
dispatcher.utter_message('here is a list of tasks', tasklist)
class AsansSelect(Action):
def name(self) -> Text:
print ('check asana invoked')
return "select_asana_action"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
text_of_last_user_message = tracker.latest_message.get("text")
print ('this is the last user message in asana capture', text_of_last_user_message)
capture = re.search('(\d. )(.*\n)', text_of_last_user_message)
print ('this is the capture', capture)
#task_name_selected = capture.group(1)
print ('DEBUG: this is the selected task', task_name_selected)
return task_name_selected
Rules
# check asana
- rule: check asana rule 1
steps:
- intent: check_asana
- action: utter_asana_task_name
- rule: check asana rule 2
steps:
- action: utter_asana_task_name
- action: check_asana_action
- action: select_asana_action