How to initialize Bot framework dialog in a Luis intent block

好久不见. 提交于 2019-12-13 03:50:40

问题


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?

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

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
}

回答1:


You could try something like this in your if statement

await dc.BeginDialogAsync(nameof(YourDialogClass));

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

Also, have a look at the Bot Enterprise Template.



来源:https://stackoverflow.com/questions/57175155/how-to-initialize-bot-framework-dialog-in-a-luis-intent-block

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