예제 #1
0
        private async Task <DialogTurnResult> FinalStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken = default)
        {
            var accessor    = _userState.CreateProperty <string>("Solicitacao");
            var solicitacao = await accessor.GetAsync(stepContext.Context, cancellationToken : cancellationToken);

            var intencaoSolicitacao = ((FoundChoice)stepContext.Result).Value;

            var intentName = "None";

            switch (intencaoSolicitacao)
            {
            case "Nenhuma":
                intentName = "None";
                break;

            case "Estou apenas te cumprimentando :)":
                intentName = "Saudacao";
                break;

            case "Fazer uma reserva":
                intentName = "Reserva";
                break;

            case "Solicitar o serviço de quarto":
                intentName = "ServicoQuarto";
                break;

            case "Solicitar o serviço de despertador":
                intentName = "Despertador";
                break;

            case "Sair":
                return(await stepContext.ReplaceDialogAsync(nameof(RootDialog), cancellationToken : cancellationToken));
            }
            Task.Run(() => LuisService.Learn(_configuration, solicitacao, intentName));

            var message = Conversation.Answer(intentName);

            await stepContext.Context.SendActivityAsync(message, cancellationToken : cancellationToken);

            return(await stepContext.ReplaceDialogAsync(nameof(LoopDialog), cancellationToken : cancellationToken));
        }