示例#1
0
        public HighStressHandlingDialog(BotServices botServices, IBotTelemetryClient telemetryClient, IServiceProvider serviceProvider)
            : base(nameof(HighStressHandlingDialog))
        {
            _services       = botServices;
            InitialDialogId = nameof(HighStressHandlingDialog);

            var steps = new WaterfallStep[]
            {
                RespondChoice,
                ProposeTips,
                Complete
            };

            _escalateDialog       = serviceProvider.GetService <EscalateDialog>();
            _entertainDialog      = serviceProvider.GetService <EntertainDialog>();
            _stressHandlingDialog = serviceProvider.GetService <StressHandlingDialog>();
            _breatherDialog       = serviceProvider.GetService <BreatherDialog>();
            AddDialog(_entertainDialog);
            AddDialog(_escalateDialog);
            AddDialog(_stressHandlingDialog);
            AddDialog(_breatherDialog);

            AddDialog(new WaterfallDialog(InitialDialogId, steps));
            AddDialog(new TextPrompt(DialogIds.TipsPrompt));
        }
示例#2
0
        public StressHandlingDialog(BotServices botServices, EntertainDialog entertainDialog, IBotTelemetryClient telemetryClient, IServiceProvider serviceProvider)
            : base(nameof(StressHandlingDialog))
        {
            _services       = botServices;
            InitialDialogId = nameof(StressHandlingDialog);

            var steps = new WaterfallStep[]
            {
                Initiate,
                RespondChoice,
                ProposeTips,
                Complete
            };


            _escalateDialog = serviceProvider.GetService <EscalateDialog>();
            AddDialog(_escalateDialog);

            _knowledgebaseDialog = serviceProvider.GetService <KnowledgeBaseDialog>();
            AddDialog(_knowledgebaseDialog);
            AddDialog(new WaterfallDialog(InitialDialogId, steps));
            AddDialog(new TextPrompt(DialogIds.TipsPrompt));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
        }
示例#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);
            }
        }