Botframework 操作.在不使用Input.Text Python SDK的自适应卡上提交
我正在使用Bot Builder v4 Python SDK尝试自适应卡。我正在尝试使用Input.text字段和Action.submit来收集用户的反馈Botframework 操作.在不使用Input.Text Python SDK的自适应卡上提交,botframework,azure-bot-service,Botframework,Azure Bot Service,我正在使用Bot Builder v4 Python SDK尝试自适应卡。我正在尝试使用Input.text字段和Action.submit来收集用户的反馈 { "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.0", "body": [ ], "actions": [{
{
"$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"
}
]
}
}
]
}
}
]}
这在网络上运行良好。当我写下一些评论并单击OK时,这在可视化工具上可以工作,但在实践中不起作用。它会引发502错误
请参见下面的屏幕截图
我正在使用用于Python的Bot Build v4 SDK,并在Web聊天上对此进行测试。在自适应卡方面似乎没有问题,我想这与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)
在上有详细的解释,谢谢@Gary Liu-MSFT的输入。我发现了问题所在。当我在评论卡上单击OK时,消息确实会发送到机器人。发生的情况是,消息内容没有在活动对象的常规“text”属性中传递。它被传入一个新键,如{'value':{'comment':'this are comments'}。也许我应该写一个明确的答案来解释这一点。是的,@Vijay,将
值设置为输入,您可以参考以了解更多细节。