将LUIS对话框连接到窗体对话框并映射正确的字段 [英] Connecting LUIS dialog to form dialog and mapping the right fields

查看:102
本文介绍了将LUIS对话框连接到窗体对话框并映射正确的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个可以预订航班的机器人.我正在使用最新版本的bot框架(1.1),如建议在这里建议.

I am working on a bot where you can book a flight. I'm working with the latest version of the bot framework (1.1), as suggested suggested here.

您可以说诸如预订下周一从阿姆斯特丹到波士顿的航班"之类的话.

You can say things like "Book me a flight from Amsterdam to Boston next monday".

现在,我将LUIS配置为以意图"BookFlight"进行响应,并且在我的机器人中,我像这样制作了LuisDialog和FormDialog:

Now, I configured LUIS to respond with the intent "BookFlight" and in my bot I've made a LuisDialog and FormDialog like so:

[LuisIntent("BookFlight")]
public async Task Process(IDialogContext context, LuisResult result)
{
    var form = new BookFlightForm();

    var entities = new List<EntityRecommendation>(result.Entities);

    var formDialog = new FormDialog<BookFlightForm>(form, BuildForm, FormOptions.PromptInStart, entities);

    context.Call(formDialog, OnComplete);
}

[Serializable]
public class BookFlightForm
{
    [Prompt("From which city do you want to leave from? {||}", AllowDefault = BoolDefault.True)]
    [Describe("Location, example: Amsterdam")]
    public string LocationFrom { get; set; }

    [Prompt("To which city you want to fly to? {||}", AllowDefault = BoolDefault.True)]
    [Describe("Location, example: Las Vegas")]

    public string LocationTo { get; set; }

    [Prompt("When do you want to leave? {||}", AllowDefault = BoolDefault.True)]
    [Describe("Departure date, example: tomorrow, next week or any date like 12-06-2016")]
    public DateTime DepartureDate { get; set; }
}

我从路易斯收到以下答复:

I get the following response from Luis:

{
    "intent": "BookFlight",
    "score": 0.987034,
    "actions": [
        {
            "triggered": true,
            "name": "BookFlight",
            "parameters": [
            {
                "name": "locationFrom",
                "required": true,
                "value": [
                    {
                        "entity": "amsterdam",
                        "type": "Flight::LocationFrom",
                        "score": 0.8548711
                    }
                ]
            },
            {
                "name": "locationTo",
                "required": true,
                "value": [
                    {
                        "entity": "boston",
                        "type": "Flight::LocationTo",
                        "score": 0.962294638
                    }
                ]
            },
            {
                "name": "departureDate",
                "required": true,
                "value": [
                    {
                        "entity": "next monday",
                        "type": "builtin.datetime.date",
                        "resolution": 
                            {
                                "date": "2016-05-09"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

问题

该表单未填充LUIS的正确值.因此,机器人会要求您填写出发地点,日期和您要飞往的地点.但这已经描述给LUIS.

The form is not filled with the right values from LUIS. So the bot will ask you to fill in your departure location, date and the location you want to fly to. But this is already described to LUIS.

到目前为止我尝试过的事情

  1. 制作了一个没有实体子级但具有正确实体名称的新应用,表单中未填写任何值.
  2. 在运行时将实体的类型"从"Flight :: LocationTo"重命名为"LocationTo"等.此方法有效,但在该日期无效.
  3. 使用正确的值预填充'BookFlightForm'的新实例,但漫游器仍会询问日期值.

所以我有点不解该如何解决.我是否正确配置了LUIS?我是否需要配置EntityRecognizer? LUIS实体属性会很好.

So I am a bit puzzled how to fix this. Did I configure LUIS correctly? Do I need to configure the EntityRecognizer? A LUIS entity attribute would be nice.

希望你能帮助我!

推荐答案

您的Luis实体类型应与表单中的字段名称匹配.如果将Luis实体的"type": "Flight::LocationFrom"更改为"type": "LocationFrom",则表单流应与该实体与表单中的LocationFrom字段匹配,并正确地填充它.

Your Luis entity type should match the field name in your form. If you change "type": "Flight::LocationFrom" to "type": "LocationFrom" for your Luis entity, form flow should match the entity with the LocationFrom field in your form and populate it correctly.

这篇关于将LUIS对话框连接到窗体对话框并映射正确的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆