Can some one help me to fix this.
rules.yml
> - rule: activate document search form
>
> steps:
>
> - intent: lookingfordocuments # intent that triggers form activation
>
> - action: document_form # run the form
>
> - active_loop: document_form # this form is active
>
> - rule: submit form
>
> condition:
>
> - active_loop: document_form # this form must be active
>
> steps:
>
> - action: document_form # run the form
>
> - active_loop: null # the form is no longer active because it has been filled
>
> - action: action_submit
>
> - intent: deny
>
> - action: utter_welcome
actions.py
class ValidateDocumentSearchForm(Action): def name(self) → Text: return “document_form”
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["userquery", "segment"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class ActionSubmit(Action):
def name(self) -> Text:
return "action_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
query = tracker.get_slot("userquery")
scope = tracker.get_slot("segment")
####Document Search/Lookup logic ####
botsearchresponse = "some response i am sending here"
buttons_help = [
{"payload": "/affirm", "title": "Yes"},
{"payload": "/deny", "title": "No"},
]
dispatcher.utter_message(botsearchresponse)
dispatcher.utter_message(text ="Is there anything else I can help you?", buttons=buttons_help)
return []`Preformatted text`
I have no stories created as i was executing the forms with custom action.py
Best Regards, Ravi