A já používám Python Bot Builder framework a já jsem to testoval na emulátoru. Teď vím, že moje adaptivní karty JSON souboru je perfektní, protože to show, to všechna data, jak jsem chtěl, na obou VisualStudio Kód a https://adaptivecards.io/designer/. Nicméně, když jsem spustit emulátor moje adaptivní je zcela prázdný.
Nyní kód jsem pomocí pro můj adaptivní karta je:
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 )
Pak jsem spustit to pomocí:
FlightDetailCard = self.adaptive_flight_card_attachment()
response = MessageFactory.attachment(FlightDetailCard)
await turn_context.send_activity(response)
Někde dělám chybu a nemůžu zaostřit, kde. Takže může mi někdo prosím pomoct?