Exemple #1
0
        private async Task <DialogTurnResult> ProcessConfirmation(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            var intent = await LuisHelper.GetIntent(_services, sc, cancellationToken);

            if (intent == GeneralLuis.Intent.Confirm)
            {
                // show entertainment
                DecrementedCountRefusal(sc);
                var card = await GetEntertainCard(sc);

                await sc.Context.SendActivityAsync(card, cancellationToken);

                IncrementShowing(sc);
                if (ShowingLimitReached(sc))
                {
                    return(await sc.EndDialogAsync());
                }

                return(await sc.PromptAsync(DialogIds.EmptyPrompt, new PromptOptions { }, cancellationToken));
            }

            IncrementCountRefusal(sc);
            if (RefusalLimitReached(sc))
            {
                // talk to human
                await sc.EndDialogAsync(cancellationToken : cancellationToken);

                return(await sc.BeginDialogAsync(nameof(EscalateDialog)));
            }

            IncrementContentIndex(sc);
            // loop back
            return(await sc.ReplaceDialogAsync(nameof(EntertainDialog), GetOptionsFromStepContext(sc)));
        }
Exemple #2
0
        private async Task <DialogTurnResult> ProposeTips(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            var intent = await LuisHelper.GetIntent(_services, sc, cancellationToken);

            if (intent == GeneralLuis.Intent.Confirm)
            {
                return(await sc.BeginDialogAsync(nameof(EntertainDialog)));
            }
            return(await sc.EndDialogAsync());
        }