Venkat
(Nrayanaswamy R)
September 10, 2021, 7:55am
1
HI , I made some custom actions for my project , but the responses entered in the custom actions is not uttered by the bot .
I have attached the python code for the custom actions
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class area_options(Action):
def name (self) -> Text:
return "action_area_buttons"
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text,Any]) -> List[Dict[Text, Any]]:
value = tracker.get_slot("area_travel")
if value == 'Domestic':
dispatcher.utter_message(message= "utter_domestic_packages")
elif value == 'International':
dispatcher.utter_message(message= "utter_international_packages")
return []
nik202
(NiK202)
September 10, 2021, 9:09am
2
Hello @Venkat I guess this is same as this thread Facing syntax error with custom action in rasa open source can I politely asked why you open this new thread? as you not satisfied with the assistance and suggestion Chris and I gave you on the above thread link?
Venkat
(Nrayanaswamy R)
September 10, 2021, 9:35am
4
Hello @nik202 actually this is a different issue , I’m not facing an error , actually my bot dosn’t reply according to the story written
Venkat
(Nrayanaswamy R)
September 10, 2021, 9:39am
5
if you see in the screenshot attached below , the response of the bot after the selection of the button it should reply with another set of buttons . I have also attached the stories file for your review . stories.yml (841 Bytes)
nik202
(NiK202)
September 10, 2021, 9:40am
6
@Venkat I previously suggested you this below solution about same code and again I am sharing you the same.
Class always will be capital
class AreaOptions(Action):
Use template rather then response, if new update is enforce you to use response then fine
dispatcher.utter_message(template= "utter_domestic_packages")
dispatcher.utter_message(template= "utter_international_packages")
I hope you had seen this
nik202
(NiK202)
September 10, 2021, 9:41am
7
@Venkat there is no attachment?
Venkat
(Nrayanaswamy R)
September 10, 2021, 9:41am
8
sorry , this is the screenshot
nik202
(NiK202)
September 10, 2021, 9:42am
9
@Venkat Please share the rasa --version
@Venkat share your domain file for the above screenshot.
Venkat
(Nrayanaswamy R)
September 10, 2021, 9:46am
10
Thank you for the help , the above mentioned solution worked .