在 bot framework v4 中,如何实现带有评论框和提交按钮的评分卡
In bot framework v4, how to implemente rating card with comment box and submit button
我用C#做了一个bot framework V4。我已经在自适应卡中进行了星级评定,但我需要在其中添加评论框和提交按钮,但我的提交按钮不是 working.In 调试模式,它没有点击 bot.Kindly 的任何方法帮助我。我还附上了我的评级卡代码,其中有评论框和提交按钮。
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"color": "Accent",
"text": "Rate your experience!"
},
{
"type": "TextBlock",
"separator": true,
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your
experience in the future. ",
"wrap": true
},
{
"type": "ColumnSet",
"spacing": "Medium",
"columns": [
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "awful"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Awful"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "bad"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Bad"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "ok"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Ok"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "good"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Good"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "terrific"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Terrific"
}
],
"width": "stretch"
}
]
},
{
"type": "Input.Text",
"id": "comment",
"placeholder": "Add a comment",
"isMultiline": true
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"actions": [
{
"type": "Action.Submit",
"title": "Ok",
"data": "ok"
}
]
}
您的卡 JSON 有几个问题需要解决:
- 您的操作没有标题。
- 您应该将
data
设为 object 而不是字符串。字符串在大多数情况下都有效,但不太一致。
您可以通过 copy/pasting 您的代码 in the Designer 并查找错误来 find/fix 大多数卡错误:
我已经重新创建了您的卡,因此它可以正常工作:
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Rate your experience!",
"weight": "Bolder",
"color": "Accent",
"size": "Medium"
},
{
"type": "TextBlock",
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your experience in the future. ",
"wrap": true
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "awful" },
"title": "awful"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "bad" },
"title": "bad"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "ok" },
"title": "ok"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "good" },
"title": "good"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "terrific" },
"title": "terrific"
}
}
]
}
]
},
{
"type": "Input.Text",
"placeholder": "Add a comment",
"isMultiline": true,
"id": "comment"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"actions": [
{
"type": "Action.Submit",
"title": "Ok"
}
]
}
注意,反馈会在 Activity.Value.rating
我用C#做了一个bot framework V4。我已经在自适应卡中进行了星级评定,但我需要在其中添加评论框和提交按钮,但我的提交按钮不是 working.In 调试模式,它没有点击 bot.Kindly 的任何方法帮助我。我还附上了我的评级卡代码,其中有评论框和提交按钮。
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"color": "Accent",
"text": "Rate your experience!"
},
{
"type": "TextBlock",
"separator": true,
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your
experience in the future. ",
"wrap": true
},
{
"type": "ColumnSet",
"spacing": "Medium",
"columns": [
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "awful"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Awful"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "bad"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Bad"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "ok"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Ok"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "good"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Good"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "terrific"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Terrific"
}
],
"width": "stretch"
}
]
},
{
"type": "Input.Text",
"id": "comment",
"placeholder": "Add a comment",
"isMultiline": true
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"actions": [
{
"type": "Action.Submit",
"title": "Ok",
"data": "ok"
}
]
}
您的卡 JSON 有几个问题需要解决:
- 您的操作没有标题。
- 您应该将
data
设为 object 而不是字符串。字符串在大多数情况下都有效,但不太一致。
您可以通过 copy/pasting 您的代码 in the Designer 并查找错误来 find/fix 大多数卡错误:
我已经重新创建了您的卡,因此它可以正常工作:
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Rate your experience!",
"weight": "Bolder",
"color": "Accent",
"size": "Medium"
},
{
"type": "TextBlock",
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your experience in the future. ",
"wrap": true
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "awful" },
"title": "awful"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "bad" },
"title": "bad"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "ok" },
"title": "ok"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "good" },
"title": "good"
}
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Image",
"altText": "",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg",
"selectAction": {
"type": "Action.Submit",
"data": { "rating": "terrific" },
"title": "terrific"
}
}
]
}
]
},
{
"type": "Input.Text",
"placeholder": "Add a comment",
"isMultiline": true,
"id": "comment"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"actions": [
{
"type": "Action.Submit",
"title": "Ok"
}
]
}
注意,反馈会在 Activity.Value.rating