【发布时间】:2020-03-12 11:51:28
【问题描述】:
我正在尝试使以下示例机器人正常工作。
我可以运行它并使用 Bot Framework Emulator 成功连接到它。
以下对话有效:
预订航班
- 您的出发城市是?
迈阿密 - 您想去哪里旅行?
达拉斯 - 您的出发日期是什么时候?
明天 - 这听起来对您来说是正确的吗?我有你前往:达拉斯,出发地:迈阿密:2020-03-13
是的 - 我已为您预订了 2020 年 3 月 13 日从迈阿密飞往达拉斯的机票。
问题是当我尝试预订航班并同时提供城市时
“从迈阿密预订航班” - 你的出发城市是?
我的理解是机器人应该将实体 miami 识别为出发城市,然后询问目的地城市。
我相信 RootDialog.cs 文件(我直接使用示例)在 Book_flight 意图中使用 SetProperty() 来完成此操作。
我认为 SetProperty() 操作会存储实体
Value = "@fromCity.location"
在属性中
Property = "conversation.flightBooking.destinationCity"
随后,TextInput 将使用提示符
Prompt = new ActivityTemplate("@{PromptForMissingInformation()}")
读取 RootDialog.lg 文件
# PromptForMissingInformation
- IF: @{conversation.flightBooking.departureCity == null}
- @{PromptForDepartureCity()}
- ELSEIF: @{conversation.flightBooking.destinationCity == null}
- @{PromptForDestinationCity()}
- ELSEIF: @{conversation.flightBooking.departureDate == null}
- @{PromptForTravelDate()}
- ELSE:
- @{ConfirmBooking()}
如果已经提供/存储了出发城市,则不应提示它。
我还使用 Bot Framework Emulator 中的 LUIS 跟踪查看了从 LUIS 返回的结果。 LUIS 似乎正确地将意图 Book_flight 和实体 fromCity 识别为 miami
{
"recognizerResult": {
"alteredText": null,
"entities": {
"$instance": {
"fromCity": [
{
"endIndex": 22,
"startIndex": 17,
"text": "miami",
"type": "builtin.geographyV2.city"
}
]
},
"fromCity": [
{
"location": "miami",
"type": "city"
}
]
},
"intents": {
"Book_flight": {
"score": 0.941154063
}
},
"text": "book flight from miami"
}
}
为什么 SetProperty() 不保存 fromCity 实体信息?可以删除 3 个 SetProperty() 操作,机器人仍然可以正常工作。这个示例机器人是否适用于其他人?我错过了什么?
任何帮助将不胜感激。
【问题讨论】:
标签: c# json botframework chatbot azure-language-understanding