Actions.py not response - Rasa Open Source - Rasa Community Forum
👋 Introducing the Rasa Playground
Actions.py not response
post by trinhminhhieu on Oct 12, 2021
Hello everyone, I have not received a response from actions.py
domain.yml file
actions:
- action_activities_offerd #slide products
stories.yml
- story: order shoes
steps:
- intent: order_shoes
- action: utter_brands
- intent: brand_shoes
- action: action_activities_offerd
actions.py
class ActionCarousel(Action):
def name(self) -> Text:
return "action_activities_offerd"
def run(self, dispatcher, tracker: Tracker, domain: "DomainDict") -> List[Dict[Text, Any]]:
message = {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Nike Air Force 1 '07",
"subtitle": "2,649,000đ",
"image_url": "https://static.nike.com/a/images/c_limit,w_592,f_auto/t_product_v1/4f37fca8-6bce-43e7-ad07-f57ae3c13142/air-force-1-07-shoe-WrLlWX.png",
"buttons": [
{
"title": "Giày nam",
"payload": "happy",
"type": "postback"
},
{
"title": "Giày nữ",
"payload": "sad",
"type": "postback"
}
]
},
{
"title": "Carousel 2",
"subtitle": "$12",
"image_url": "https://image.freepik.com/free-vector/city-illustration_23-2147514701.jpg",
"buttons": [
{
"title": "Click here",
"url": "https://image.freepik.com/free-vector/city-illustration_23-2147514701.jpg",
"type": "web_url"
}
]
}
]
}
}
dispatcher.utter_message(attachment=message)
return []
Hope everybody help please
post by ChrisRahme on Oct 12, 2021
Hello, do you receive a response in rasa shell?
post by trinhminhhieu on Oct 12, 2021
Hi, it still doesn’t work
post by nik202 on Oct 12, 2021
Please delete the older model and re-train it again, and do let us know.
post by trinhminhhieu on Oct 12, 2021
Hi, it still doesn’t work
post by nik202 on Oct 12, 2021
@trinhminhhieu can you share the error screenshot please?
post by trinhminhhieu on Oct 12, 2021
post by nik202 on Oct 12, 2021
@trinhminhhieu Right, so you are using scalable mind /chatroom widget. can I request to integrate your chatbot using rasa webchat? If that is not a problem with your use case: Rasa chatbot website integration | Quick tutorial - YouTube OR do you want that code should run on the chatroom ( may be this code is not supportable for the chatroom widget) I am sure, this code will not support the chatroom.
Ref: https://github.com/botfront/rasa-webchat
PS: I would recommend to use rasa-webchat
post by trinhminhhieu on Oct 12, 2021
Thanks! I will try!
post by trinhminhhieu on Oct 12, 2021
@nik202 Hi, the following code is not working
script>!(function () {
let e = document.createElement("script"),
t = document.head || document.getElementsByTagName("head")[0];
(e.src =
"https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js"),
// Replace 1.x.x with the version that you want
(e.async = !0),
(e.onload = () => {
window.WebChat.default(
{
initPayload: '/greet',
customData: { language: "en" },
socketUrl: "http://localhost:5005",
// add other props here
},
null
);
}),
t.insertBefore(e, t.firstChild);
})();
</script>
post by nik202 on Oct 12, 2021
@trinhminhhieu hello please update this:
In index.html
<script>!(function () {
let e = document.createElement("script"),
t = document.head || document.getElementsByTagName("head")[0];
(e.src =
"https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.js"),
// Replace 1.x.x with the version that you want
(e.async = !0),
(e.onload = () => {
window.WebChat.default(
{
initPayload: '/greet',
customData: { language: "en" },
socketUrl: "http://localhost:5005",
// add other props here
},
null
);
}),
t.insertBefore(e, t.firstChild);
});
</script>
In credentials.yml
socketio:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: true
Note: Please mention the version if you are using rasa version 2.x then 1.0.1 else less then 2.x mention 1.0.0
Please follow the reference video for more clarity!
Good Luck!
post by trinhminhhieu on Oct 12, 2021
Thank you very much! it works!
post by nik202 on Oct 12, 2021
@trinhminhhieu No worries! Keep safe!