【问题标题】:How to initialize Bot framework dialog in a Luis intent block如何在 Luis 意图块中初始化 Bot 框架对话框
【发布时间】:2019-07-24 16:42:10
【问题描述】:

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

我尝试过使用Dotnet core 2.1版本和dispatch的最新版本

对话框代码 -

   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
}

【问题讨论】:

    标签: c# dialog botframework azure-language-understanding qnamaker


    【解决方案1】:

    你可以在你的 if 语句中尝试这样的事情

    await dc.BeginDialogAsync(nameof(YourDialogClass));
    

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

    另外,请查看 Bot Enterprise 模板。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多