How to initialize Bot framework dialog in a Luis i

2019-08-22 11:01发布

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条回答
beautiful°
2楼-- · 2019-08-22 12:01

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.

查看更多
登录 后发表回答