【发布时间】:2021-09-08 14:28:54
【问题描述】:
我尝试学习 rasa chatbot ,我尝试单击按钮并进入相关意图。但是当我单击模板中的按钮时,等待符号出现之后,我被选中而没有响应。如果尝试编写“muhtesem”机器人,请理解并回复我。如何解决此按钮问题?谢谢
class ActionCarousel(Action):
def name(self) -> Text:
return "action_carousels"
def run(self, dispatcher, tracker: Tracker, domain: "DomainDict") -> List[Dict[Text, Any]]:
message = {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Merhaba, bugün nasılsın?",
"subtitle": "$10",
"image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSqhmyBRCngkU_OKSL6gBQxCSH-cufgmZwb2w&usqp=CAU",
"buttons": [
{
"title": "Muhteşem",
"payload": "happy",
"type": "postback"
},
{
"title": "Üzgü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 []
这是模板代码。感谢支持。
【问题讨论】:
标签: python rasa-nlu rasa rasa-core