Hello,
I am trying to create a custom FormAction. The goal is to ask the user several questions and for each questions the goal is to save the whole user answer in a slot. All the inputs should then be send to a document creation service using api.
The problem is that my FormAction is not working. This is how I tried it:
class It_Innovation_Form(FormAction):
def name(self):
return "it_innovation_form"
@staticmethod
def required_slots(tracker):
return ["idea_name", "short_description", "solved_problem", "added_value", "advantage_to_existing_solutions",
"ask_technologies", "ask_awareness_technologies", "difficulty_it_innovation", "situation_withoutinnovation"]
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
'''A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked'''
return {
"idea_name": [
self.tracker.latest_message.text,
],
"short_description": [
self.tracker.latest_message.text,
],
"solved_problem": [
self.tracker.latest_message.text,
],
"added_value": [
self.tracker.latest_message.text,
],
"advantage_to_existing_solutions": [
self.tracker.latest_message.text,
],
"ask_technologies": [
self.tracker.latest_message.text,
],
"ask_awareness_technologies": [
self.tracker.latest_message.text,
],
"difficulty_it_innovation": [
self.tracker.latest_message.text,
],
"situation_withoutinnovation": [
self.tracker.latest_message.text,
],
}
def submit(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
dispatcher.utter_message("Thanks for your inputs, you have now described your innovation idea!")
return []
Blockquote
I get the following error message: AttributeError: ‘It_Innovation_Form’ object has no attribute ‘tracker’
If any of you have tips on how to solve my problem that would be great.