Created a formAction and specify that in Domain File under forms tab but its giving this error
Exception: Can not access action ‘rate_form’, as that name is not a registered action for this domain. Available actions are:
Domain file:
forms:
- rate_form
slots: ratings_comments: type: unfeaturized ratings: type: unfeaturized
utter_ask_ratings:
- text: “On a scale of 1-5, how much will you rate?”
utter_ask_ratings_comments:
- text: “Any comments about the app?”
Stories.md:
Rate App
- rate
- rate_form
- form{“name”: “rate_form”}
- form{“name”: null}
Actions.py
from rasa_core_sdk.events import SlotSet from rasa_core_sdk.forms import FormAction from rasa_core_sdk import Tracker from typing import Dict, Text, Any, List, Union from rasa_core_sdk.executor import CollectingDispatcher
import json
class RatingsForm(FormAction):
def name(self):
# type: () -> Text
"""Unique identifier of the form"""
return "rate_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
return ["ratings", "ratings_comments"]
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 []
def slot_mapping(self):
# type: () -> Dict[Text: Union[Text, Dict, List[Text, Dict]]]
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where the first match will be picked"""
return {"ratings": self.from_entity(entity="CARDINAL",
intent=None)}