Example #1
0
        public ChitchatDialog(
            BotServices botServices,
            IServiceProvider serviceProvider,
            IBotTelemetryClient telemetryClient)
            : base(nameof(ChitchatDialog))
        {
            _services = botServices;

            InitialDialogId = nameof(ChitchatDialog);


            var steps = new WaterfallStep[]
            {
                Initiate,
                ChitchatQNA,
                Feedback,
                FeedbackProcessAsync
            };

            _cancelDialog = serviceProvider.GetService <CancelDialog>();

            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            AddDialog(_cancelDialog);
            AddDialog(new WaterfallDialog(InitialDialogId, steps));
        }
Example #2
0
        public BreatherDialog(
            BotServices botServices,
            IServiceProvider serviceProvider,
            IBotTelemetryClient telemetryClient)
            : base(nameof(BreatherDialog))
        {
            _services = botServices;

            InitialDialogId = nameof(BreatherDialog);


            var steps = new WaterfallStep[]
            {
                Initiate,
                Feedback,
                FeedbackProcessAsync,
                Complete
            };

            _cancelDialog         = serviceProvider.GetService <CancelDialog>();
            _stressHandlingDialog = serviceProvider.GetService <StressHandlingDialog>();
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt))
            {
                Style = ListStyle.HeroCard
            });
            AddDialog(_cancelDialog);
            AddDialog(_stressHandlingDialog);
            AddDialog(new WaterfallDialog(InitialDialogId, steps));
        }
Example #3
0
        public MainDialog(
            IServiceProvider serviceProvider,
            IBotTelemetryClient telemetryClient)
            : base(nameof(MainDialog), serviceProvider, telemetryClient)
        {
            _services       = serviceProvider.GetService <BotServices>();
            _settings       = serviceProvider.GetService <BotSettings>();
            _templateEngine = serviceProvider.GetService <LocaleTemplateEngineManager>();
            _skillsConfig   = serviceProvider.GetService <SkillsConfiguration>();

            var userState = serviceProvider.GetService <UserState>();

            _userProfileState = userState.CreateProperty <UserProfileState>(nameof(UserProfileState));
            var conversationState = serviceProvider.GetService <ConversationState>();

            _previousResponseAccessor = conversationState.CreateProperty <List <Activity> >(StateProperties.PreviousBotResponse);

            WaterfallStep[] steps = SetupWaterfallSteps();

            AddDialog(new WaterfallDialog(nameof(MainDialog), steps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt))
            {
                Style = ListStyle.HeroCard
            });
            InitialDialogId = nameof(MainDialog);

            // Register dialogs
            _oauthPrompt              = serviceProvider.GetService <OAuthPrompt>();
            _loginDialog              = serviceProvider.GetService <LoginDialog>();
            _onboardingDialog         = serviceProvider.GetService <OnboardingDialog>();
            _switchSkillDialog        = serviceProvider.GetService <SwitchSkillDialog>();
            _escalateDialog           = serviceProvider.GetService <EscalateDialog>();
            _cancelDialog             = serviceProvider.GetService <CancelDialog>();
            _entertainDialog          = serviceProvider.GetService <EntertainDialog>();
            _chitchatdialog           = serviceProvider.GetService <ChitchatDialog>();
            _stressDialog             = serviceProvider.GetService <StressDialog>();
            _highstresshandlingDialog = serviceProvider.GetService <HighStressHandlingDialog>();
            _stresshandlingDialog     = serviceProvider.GetService <StressHandlingDialog>();
            _journalingDialog         = serviceProvider.GetService <JournalingDialog>();

            AddDialog(_oauthPrompt);
            AddDialog(_loginDialog);
            AddDialog(_onboardingDialog);
            AddDialog(_switchSkillDialog);
            AddDialog(_escalateDialog);
            AddDialog(_cancelDialog);
            AddDialog(_entertainDialog);
            AddDialog(_chitchatdialog);
            AddDialog(_stressDialog);
            AddDialog(_highstresshandlingDialog);
            AddDialog(_stresshandlingDialog);
            AddDialog(_journalingDialog);



            // Register a QnAMakerDialog for each registered knowledgebase and ensure localised responses are provided.
            var localizedServices = _services.GetCognitiveModels();

            foreach (var knowledgebase in localizedServices.QnAConfiguration)
            {
                var qnaDialog = new QnAMakerDialog(
                    knowledgeBaseId: knowledgebase.Value.KnowledgeBaseId,
                    endpointKey: knowledgebase.Value.EndpointKey,
                    hostName: knowledgebase.Value.Host,
                    noAnswer: _templateEngine.GenerateActivityForLocale("UnsupportedMessage"),
                    activeLearningCardTitle: _templateEngine.GenerateActivityForLocale("QnaMakerAdaptiveLearningCardTitle").Text,
                    cardNoMatchText: _templateEngine.GenerateActivityForLocale("QnaMakerNoMatchText").Text)
                {
                    Id = knowledgebase.Key
                };
                AddDialog(qnaDialog);
            }

            // Register skill dialogs
            var skillDialogs = serviceProvider.GetServices <SkillDialog>();

            foreach (var dialog in skillDialogs)
            {
                AddDialog(dialog);
            }
        }