如何解决Bot Framework模拟器/ Web聊天中不呈现AdaptiveCard
真的希望有人能对此提供帮助。
我正在尝试实现-使用QnAMaker.ai和Azure Bot Services和AdaptiveCard来提供丰富内容的无代码聊天机器人。
我已经建立并发布了一个知识库,我已经在Azure中设置了一个机器人来提供该内容,并且在第一阶段似乎还可以。
现在,我正在尝试添加AdaptiveCards ,而无需在VSCode中打开和编辑解决方案-我真的想将所有这些内容保留在无代码解决方案中。
我用Google搜索了如何添加自定义卡片/内容,并发现了this post by LiveTiles-很好-我想,我可以添加缩小的JSON,它将呈现出我想要的东西-可爱的东西!
但是;尽管LiveTiles站点上有实时输出渲染,但是当我使用JSON时,我无法通过Web Chat或Bot Framework Emulator来渲染它。
我尝试过...
- 将原始JSON复制/粘贴到QnAPair中
{
"contentType": "application/vnd.microsoft.card.adaptive","content": {
"type": "AdaptiveCard","version": "1.0","body": [
{
"type": "Image","url": "","size": "stretch","selectAction": {
"type": "Action.OpenUrl","title": "Test","url": "https://www.livetiles.nyc/"
}
},{
"type": "TextBlock","text": "This is an adaptive card - if this renders it means it's worked!","wrap": true
}
],"actions": [
{
"type": "Action.Submit","title": "Let's get started!","url": "Let's get started!"
}
]
}
}
- 将缩小的JSON复制/粘贴到QnAPair中
{"contentType":"application/vnd.microsoft.card.adaptive","content":{"type":"AdaptiveCard","version":"1.0","body":[{"type":"Image","url":"","size":"stretch","selectAction":{"type":"Action.OpenUrl","title":"Test","url":"https://www.livetiles.nyc/"}},{"type":"TextBlock","text":"This is an adaptive card - if this renders it means it's worked!","wrap":true}],"actions":[{"type":"Action.Submit","title":"Let's get started!","url":"Let's get started!"}]}}
- 制作一个源Excel文件(包括JSON)并将其添加到知识库中
我所有的尝试最终都随着该机器人向我吐出真正的JSON而告终。不是我想要的可爱的渲染卡。
在QnAMaker.ai测试功能中
真的希望有人可以对此提供一些见识或建议。
解决方法
请尝试在json以下对我有用的
{
//"contentType": "application/vnd.microsoft.card.adaptive",//"content": {
"type": "AdaptiveCard","version": "1.0","body": [
{
"type": "Image","url": "","size": "stretch","selectAction": {
"type": "Action.OpenUrl","title": "Test","url": "https://www.livetiles.nyc/"
}
},{
"type": "TextBlock","text": "This is an adaptive card - if this renders it means it's worked!","wrap": true
}
],"actions": [
{
"type": "Action.Submit","title": "Let's get started!","url": "Let's get started!"
}
]
//}
}
code for send card as an attachment :
var cardAttachment = Common.CreateAdaptiveCardAttachment();
await turnContext.SendActivityAsync(MessageFactory.Attachment(cardAttachment),cancellationToken);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。