예제 #1
0
        private async Task <DialogTurnResult> VerifyLuisIntentionStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var response = stepContext.Context.Activity.CreateReply();

            if (Log)
            {
                UltimaMensagem = stepContext.Context.Activity.Text;
                var intencao = LuisService.ObterIntencao(UltimaMensagem);
                switch (intencao)
                {
                case "BancoDeHorasQuery":
                    response.Attachments = new List <Attachment>()
                    {
                        ObterCardAttachment("HorasCard.json")
                    };
                    await stepContext.Context.SendActivityAsync(response);

                    UltimaMensagem = stepContext.Context.Activity.Text;
                    return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));

                case "ProximasFeriasQuery":
                    response.Attachments = new List <Attachment>()
                    {
                        ObterCardAttachment("FeriasCard.json")
                    };
                    await stepContext.Context.SendActivityAsync(response);

                    UltimaMensagem = stepContext.Context.Activity.Text;
                    return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));

                default:
                    await stepContext.Context.SendActivityAsync(MessageFactory.Text("Não entendi sua pergunta..."));

                    UltimaMensagem = stepContext.Context.Activity.Text;
                    return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
                }
            }
            else
            {
                return(await stepContext.NextAsync("", cancellationToken));
            }
        }