Adaptive Cards中Separator属性在BotFramework Emulator不显示求助
问题分析与解决方案
你遇到的这个情况并不是代码的问题,核心原因是Bot Framework Emulator内置的Adaptive Cards渲染引擎版本和官方Visualizer不一致,导致separator属性无法被正确解析渲染。
先确认:你的代码完全没问题
你提供的Adaptive Card JSON完全符合官方规范,separator: true的使用方式是正确的——Visualizer能正常显示分隔线就已经证明了这一点。这里把你的代码整理成格式化的JSON块方便查看:
{ "contentType": "application/vnd.microsoft.card.adaptive", "content": { "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.0", "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "text": "Meeting Title", "weight": "bolder" }, { "type": "TextBlock", "text": "Location", "separator": true, "isSubtle": true, "size": "small" }, { "type": "TextBlock", "text": "Location", "spacing": "none" }, { "type": "TextBlock", "text": "Organizer", "separator": true, "isSubtle": true, "size": "small" }, { "type": "TextBlock", "text": "Organizer Name", "spacing": "none" }, { "type": "TextBlock", "text": "Start Time", "separator": true, "isSubtle": true, "size": "small" }, { "type": "ColumnSet", "spacing": "none", "columns": [ { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "text": "05:00 PM", "isSubtle": false, "weight": "bolder" } ] }, { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "text": "May 21" } ] }, { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "text": "2017", "isSubtle": true, "weight": "bolder" } ] } ] }, { "type": "TextBlock", "text": "End Time", "separator": true, "isSubtle": true, "size": "small" }, { "type": "ColumnSet", "spacing": "none", "columns": [ { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "text": "05:30 PM", "isSubtle": false, "weight": "bolder" } ] }, { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "text": "May 21" } ] }, { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "text": "2017", "isSubtle": true, "weight": "bolder" } ] } ] } ], "actions": [ { "type": "Action.Submit", "title": "Accept", "data": { "accept": true } }, { "type": "Action.Submit", "title": "Decline", "data": { "accept": false } } ] } }
为什么Emulator不渲染分隔线?
早期版本的Bot Framework Emulator使用的Adaptive Cards渲染器版本较低,对一些较新的属性(比如separator)支持不足。而Adaptive Cards Visualizer是官方的实时预览工具,会同步跟进最新的规范和渲染能力,所以能正确显示分隔线。
解决方法
- 升级Bot Framework Emulator到最新版本:新版本会同步更新内置的Adaptive Cards渲染引擎,解决这类兼容性问题。
- 在实际客户端测试:如果升级后仍有疑问,可以在真实的Bot客户端(比如Microsoft Teams、Web Chat)中测试,这些客户端的渲染引擎通常会保持更新,能正确识别并渲染
separator属性。
内容的提问来源于stack exchange,提问作者Saurav Sircar
相关产品推荐
相关产品推荐

