![](/img/trans.png)
[英]Action.Submit on Adaptive cards is not calling the next step (not working only in Microsoft Teams works in web chat) : Bot Framework V4
[英]Action.Submit on Adaptive Cards not working with Input.Text Python SDK
我正在使用Bot Builder v4 Python SDK尝试自适应卡。 我正在尝试使用Input.text字段然后从Action.submit收集用户的反馈
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
],
"actions": [{
"type": "Action.ShowCard",
"title": "Want to provide feedback",
"card": {
"type": "AdaptiveCard",
"actions": [
{
"type": "Action.Submit",
"data": "Yes, it was helpful",
"title": "Yes"
},
{
"type": "Action.Submit",
"data": "No, it wasn't helpful",
"title": "No"
},
{
"type": "Action.Submit",
"data": "Start Over",
"title": "Start Over"
},
{
"type": "Action.Submit",
"data": "Exit",
"title": "Exit"
},{
"type": "Action.ShowCard",
"title": "Comment",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"id": "comment",
"isMultiline": true,
"placeholder": "Enter your comment"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "OK"
}
]
}
}
]
}
}
]}
这在可视化器上运行良好。 当我写一些注释并单击“确定”时,这在可视化工具上有效,但在实践中不起作用。 它将引发502错误。
我正在使用Bot Build v4 SDK for Python,并在网络聊天中对此进行测试。 似乎在Adaptive Card方面没有问题,我想这与Python SDK有关。 任何有关错误可能在哪里的指针?
请尝试以下代码片段进行快速测试:
def __create_reply_activity(request_activity):
return Activity(
type=ActivityTypes.message,
channel_id=request_activity.channel_id,
conversation=request_activity.conversation,
recipient=request_activity.from_property,
from_property=request_activity.recipient,
attachments=[Attachment(
content_type='application/vnd.microsoft.card.adaptive',
content={
"type": "AdaptiveCard",
"body": [
],
"actions": [{
"type": "Action.ShowCard",
"title": "Want to provide feedback",
"card": {
"type": "AdaptiveCard",
"actions": [
{
"type": "Action.Submit",
"data": "Yes, it was helpful",
"title": "Yes"
},
{
"type": "Action.Submit",
"data": "No, it wasn't helpful",
"title": "No"
},
{
"type": "Action.Submit",
"data": "Start Over",
"title": "Start Over"
},
{
"type": "Action.Submit",
"data": "Exit",
"title": "Exit"
},
{
"type": "Action.ShowCard",
"title": "Comment",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"id": "comment",
"isMultiline": "true",
"placeholder": "Enter your comment"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "OK"
}
]
}
}
]
}
}],
},
)],
service_url=request_activity.service_url)
在使用python向bot框架添加自适应卡中有详细的解释
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.