Hello I’m starting to get deeper into Rasa and I encountered a problem that I cannot resolve. I have a custom action. This is how it is coded in actions.py file
class ActionDeleteTask(Action):
def name(self) -> Text:
return "action_delete_task"
def run(self, dispatcher, tracker, domain):
overall_get = OverallGetRequest(URLS)
user_info = overall_get.get_user_info()["uid"]
# get task for user id
api_get = ApiGetRequests(URLS)
user_tasks = api_get.get_task(user_info)
if user_tasks is None:
dispatcher.utter_message("You have no tasks")
get_task = GetTaskId()
#ask task name and get it from user response
task_name = tracker.get_slot("task_name")
if task_name is None:
dispatcher.utter_message("I didn't catch this task name - could You reapeat what You want to do?")
#get task id
db_response = get_task.get_task_id(user_tasks, task_name)
dispatcher.utter_message(db_response)
#delete task
if db_response is not None:
api_delete = ApiDeleteRequest(URLS)
api_delete.delete_task(db_response)
dispatcher.utter_message(template="utter_task_deleted")
else:
dispatcher.utter_message(template="utter_task_not_found")
return []
the story looks like that
- story: ask_to_delete_task
steps:
- intent: delete_task
- action: utter_ask_task_name
- intent: get_task_name
- action: action_delete_task
the domain file (or the relevant fragments of it)
actions:
- action_delete_task
- utter_ask_task_name
- utter_task_deleted
- utter_task_not_found
entities:
- task_name
slots:
task_name:
type: text
mappings:
- type: from_entity
entity: task_name
intents:
- ask_task_name
- delete_task
- add_task
- get_task_name
responses:
utter_ask_task_name:
- text: Can I have the task name?
utter_task_deleted:
- text: Task was deleted
utter_task_not_found:
- text: Task was not found
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: true
conversation_start: true
and the nlu file
- intent: delete_task
examples: |
- delete task
- delete this task
- del task
- del tasks
- intent: get_task_name
examples: |
- the task is [koniec](task_name)
- task [](task_name)
- [hotfix](task_name)
- it will be [change](task_name)
- the task is [anything](task_name)
- task [bugfix](task_name)
- [hotfix](task_name)
- it will be [change](task_name)
Here are some results from rasa run with debug flag I post them as a link because its a lot of words.
I have also tried and action is working when story has only one intend. What am I doing wrong ? What should be fixed? Thanks for any feedback