ฉันกำลังใช้ไพธอน Bot สร้างส่วนเฟรมเวิร์กและผมกำลังทดสอบมันอยู่บน emulator. ตอนนี้ฉันรู้แล้วว่านั่นของฉันปรับตัวเก่งนามบัตร LANGUAGE แฟ้มสมบูรณ์แบบเพราะว่ามันแสดงข้อมูลทั้งหมดที่ฉันปรารถนาในทั้งสอง VisualStudio รหัสแล้ว https://adaptivecards.io/designer/. แต่เมื่อฉันวิ่งไปที่ emulator ของฉันปรับตัวเก่งเป็นเรื่องช่องว่างนะ
ตอนนี้ครหัสฉันกำลังใช้สำหรับปรับตัวเก่งการ์ดคือ:
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)
ที่ไหนสักแห่งในตอนนี้ฉันกำลังทำผิดพลาดและฉันไม่สามารถดูเหมือนจะปักหมุดประเด็นที่ไหน ดังนั้นใครก็ได้ได้โปรดช่วยฉันออกมาที่นี่?