简体   繁体   English

如何在Luis Intent块中初始化Bot框架对话框

[英]How to initialize Bot framework dialog in a Luis intent block

Bot Framework Sample - NLP Dispatch Hi, I am using NLP dispatch, where I am having multiple Luis and QnA models running simultaneously. Bot Framework示例-NLP分派嗨,我正在使用NLP分派,在这里我同时运行多个Luis和QnA模型。 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. 我已经为Luis映射了得分最高的意图,并创建了一个对话框类,我也想在这些意图映射的块中实现。 How can I initialize my dialog in the intent if block? 如何在if块中初始化对话框?

I have tried using Dotnet core 2.1 version and dispatch's latest version 我已经尝试使用Dotnet core 2.1版本和dispatch的最新版本

code for dialog - 对话代码-

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

intent block 意向块

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

You could try something like this in your if statement 您可以在if语句中尝试类似的方法

await dc.BeginDialogAsync(nameof(YourDialogClass));

note - I am assuming your code is inside a RouterDialog and dc is the DialogContext instance 注-我假设您的代码在RouterDialog中,而dc是DialogContext实例

Also, have a look at the Bot Enterprise Template. 另外,看看Bot Enterprise模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM