将Luis实体映射到对话框字段 [英] Mapping Luis Entities to Dialog Fields

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

问题描述

我在将Luis实体绑定到FormFlow字段时遇到麻烦,因此我可以跳过FormFlow中的步骤.我的FormFlow对话框的简化版本如下

I'm having trouble getting my Luis Entities to bind to my FormFlow fields so I can skip steps in the FormFlow. A simplified version of my FormFlow dialog is as follows

[Serializable]
public class DoSearch
{
    public string SearchTerm;

    public static IForm<DoSearch> BuildForm()
    {
        var builder = new FormBuilder<DoSearch>();

        return builder
            .Message("Search Function")
            .Field(nameof(DoSearch.SearchTerm))
            .AddRemainingFields()
            .Confirm("Are you sure you wish to search for {SearchTerm} ?")
            .Build();
    }

}

我用以下代码称呼它

    public async Task StartSearch(IDialogContext context, LuisResult result)
    {

        var searchForm = new BuildForm<DoSearch>(() => DoSearch.BuildForm());
        var searchForm1 = new FormDialog<DoSearch>(new DoSearch(), searchForm , FormOptions.PromptInStart, result.Entities);
        context.Call<searchForm>(searchForm1, SearchComplete);
        // ...
    }

结果.实体确实包含适当的实体(类型= SearchTerm),但是FormFlow总是在运行时要求它.

The result.Entities does contain the appropriate entity (Type = SearchTerm) but the FormFlow always asks for this when it runs.

Pizza bot示例代码示例示例似乎可以正常工作,但我似乎无法将其绑定到字段.

The example Pizza bot sample code seems to work, but I can't seem to get it to bind the entity to the field.

有人知道我在做什么错吗?

Anyone have any ideas what I'm doing wrong?

预先感谢

推荐答案

如果您获得了SDK的最新版本,那么它应该可以工作.

If you get the last version of the SDK it should work.

此提交已解决此问题: https://github.com/Microsoft/BotBuilder/commit/e81b9dd23b3c69024caf8b53dcddc0bf158f61e2

This has been fixed in this commit : https://github.com/Microsoft/BotBuilder/commit/e81b9dd23b3c69024caf8b53dcddc0bf158f61e2

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

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