我使用的是蟒蛇Bot建设者的框架和我测试它在模拟器。 现在我知道我的适应卡JSON文件是完美的,因为它显示的所有数据作为我需要两码和visual studio https://adaptivecards.io/designer/. 但是当我运行模拟器我的适应性是完全空白。
现在的代码,我在使用我自适应卡是:
def adaptive_flight_card_attachment(self):
JSONFileName = 'QuickAdaptiveJSONfile.json'
file_path = "AdaptiveFlightCardFile"
if os.path.exists(file_path):
files_in_dir = os.listdir(file_path)
if JSONFileName in files_in_dir:
file_path = os.getcwd()+f'/{file_path}'+f'/{JSONFileName}'
with open(file_path, "r+", encoding="unicode_escape") as in_file:
card = json.load(in_file)
return Attachment(content_type="application/vnd.microsoft.card.adaptive", content=card )
然后我跑这种使用:
FlightDetailCard = self.adaptive_flight_card_attachment()
response = MessageFactory.attachment(FlightDetailCard)
await turn_context.send_activity(response)
某个地方在这里我犯了一个错误我不能似乎针点在哪里。 所以任何人都可以请帮我离开这里?