如何将Formflow值传递给QnaMaker

时间:2018-12-21 10:31:22

标签: bots qnamaker formflow

我正试图从FromFlow中获取一个值,并将其传递给QnA Maker以获取答案。 我尝试通过以下方式进行操作:

[LuisIntent(“ GenericQuestions”)]         公共异步任务NewGenericQuestions(IDialogContext上下文,LuisResult结果)         {             var GenericQuestionsRequestForm = new FormDialog(new GenericQuestions(),GenericQuestions.BuildForm,FormOptions.PromptInStart,null);             context.Call(GenericQuestionsRequestForm,GenericQuestionsFormCompleteAsync);         }

    private async Task GenericQuestionsFormCompleteAsync(IDialogContext context, IAwaitable<GenericQuestions> result)
    {
        try
        {
            var genericQuestionsFormData = await result;
            var question = genericQuestionsFormData.troubleshootingOption.ToString();
            await context.PostAsync(question);
            await context.Forward(new BasicQnAMakerDialog(), AfterQnA, question, CancellationToken.None);
            context.Wait(MessageReceived);
        }
        catch (FormCanceledException<MailboxRequestForm> e)
        {
            string reply;
            if (e.InnerException == null)
            {
                reply = $"You quit the request. Maybe you can finish next time!";
            }
            else
            {
                reply = "Sorry, the request could not be processed. Please try again.";
            }
            await context.PostAsync(reply);
        }
        catch (Exception)
        {
            await context.PostAsync("Sorry, the request could not be processed. Please try again.");
        }

    }

在这里,我能够从Formflow中获取正确的值,但是当我尝试将该值传递给QnA Maker时,它会出现异常。

我可以通过任何方式将FormFlow的值传递给QnA Maker。

谢谢。

0 个答案:

没有答案