在C#中从FormFlow调用LUIS [英] Call LUIS from FormFlow in C#

查看:73
本文介绍了在C#中从FormFlow调用LUIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Microsoft bot框架创建一个用于质疑的机器人用户然后理解答案。在bot框架中使用FormFlow
API对用户进行询问并检索答案。以下是表单流的代码:




public enum Genders { none, Male, Female, Other};

[Serializable]
public class RegisterPatientForm
{

    [Prompt("What is the patient`s name?")]
    public string person_name;

    [Prompt("What is the patients gender? {||}")]
    public Genders gender;

    [Prompt("What is the patients phone number?")]
    [Pattern(@"(<Undefined control sequence>\d)?\s*\d{3}(-|\s*)\d{4}")]
    public string phone_number;

    [Prompt("What is the patients Date of birth?")]
    public DateTime DOB;

    [Prompt("What is the patients CNIC number?")]
    public string cnic;


    public static IForm<RegisterPatientForm> BuildForm()
    {
        OnCompletionAsyncDelegate<RegisterPatientForm> processHotelsSearch = async (context, state) =>
        {
            await context.PostAsync($"Patient {state.person_name} registered");
        };

        return new FormBuilder<RegisterPatientForm>()
            .Field(nameof(person_name),
            validate: async (state, value) =>
            {
                //code here for calling luis
            })
            .Field(nameof(gender))
            .Field(nameof(phone_number))
            .Field(nameof(DOB))
            .Field(nameof(cnic))
            .OnCompletion(processHotelsSearch)
            .Build();
    }

}



用户可以在被要求输入时输入:

The user may enter when asked for name :



我的名字是James Bond

my name is James Bond



此外,名称可以是可变长度。我最好从这里调用luis并获取意图的实体(名称)。我目前不知道我怎么能打电话给来自FormFlow的luis对话框。

Also the name could be of variable length. I would be better to call luis from here and get the entity(name) for the intent. I am currently not aware on how could i call a luis dialog from the FormFlow.

推荐答案

您好luckyCoder777,

Hi luckyCoder777,

感谢您在此发帖。

我们不擅长Microsoft Bot Framework。

We are not good at Microsoft Bot Framework.

根据我的搜索,您可以参考代码示例以供参考。

Based on my search, you could refer to the code sample for reference.

https://github.com/ Microsoft / BotBuilder / blob / master / CSharp / Samples / PizzaBot / PizzaOrderDialog.cs#L60

最好的问候,

Wendy


这篇关于在C#中从FormFlow调用LUIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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