Mapping Luis Entities to Dialog Fields

非 Y 不嫁゛ 提交于 2019-12-13 06:44:31

问题


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();
    }

}

And I am calling this with the following code

    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);
        // ...
    }

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

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?

Thanks in advance


回答1:


It appears that this is a bug. Entities seem to bind to properties that are Enums, but that are strings.

https://github.com/Microsoft/BotBuilder/issues/151

Hopefully this will be sorted at some point




回答2:


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

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



来源:https://stackoverflow.com/questions/36712912/mapping-luis-entities-to-dialog-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!