如何在Luis Intent块中初始化Bot框架对话框 [英] How to initialize Bot framework dialog in a Luis intent block

查看:64
本文介绍了如何在Luis Intent块中初始化Bot框架对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bot Framework示例-NLP分派 你好, 我正在使用NLP分派,其中同时运行多个Luis和QnA模型.我已经为Luis映射了得分最高的意图,并创建了一个对话框类,我也想在这些意图映射的块中实现.如何在intent if块中初始化我的对话框?

Bot Framework Sample - NLP Dispatch Hi, I am using NLP dispatch, where I am having multiple Luis and QnA models running simultaneously. I have mapped top-scoring intents for Luis and have created a dialog class also which I want to implement in those intents mapped blocks. How can I initialize my dialog in the intent if block?

我尝试使用Dotnet core 2.1版本并调度了最新版本

I have tried using Dotnet core 2.1 version and dispatch's latest version

对话代码-

   private async Task<DialogTurnResult> LeaveDateRangeStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
    {
        var leaveApply = (LeaveApplication)stepContext.Options;

        if (leaveApply.TravelDate == null){
            return await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text("Please Provide me with your Leaves Tenure") }, cancellationToken);
        }
        else{
            return await stepContext.NextAsync(leaveApply.TravelDate, cancellationToken);
        }
    }

意图阻止

if (topIntent == "LeavesDateTenure"){   
    // here I want my dialog to work
}

推荐答案

您可以在if语句中尝试类似的操作

You could try something like this in your if statement

await dc.BeginDialogAsync(nameof(YourDialogClass));

注意-我假设您的代码在RouterDialog中,而dc是 DialogContext实例

note - I am assuming your code is inside a RouterDialog and dc is the DialogContext instance

另外,看看Bot Enterprise模板.

Also, have a look at the Bot Enterprise Template.

这篇关于如何在Luis Intent块中初始化Bot框架对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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