Exemple #1
0
        public FitnessBot(BotServices services, UserState userState, ConversationState conversationState, IEnumerable <IBotCommand> botCommands, ActiveConversationsStore activeConversationsStore, IDisplayAdvice advice, GreetingStateStore greetingStateStore)
        {
            _services                 = services ?? throw new ArgumentNullException(nameof(services));
            _userState                = userState ?? throw new ArgumentNullException(nameof(userState));
            _conversationState        = conversationState ?? throw new ArgumentNullException(nameof(conversationState));
            _botCommands              = botCommands;
            _activeConversationsStore = activeConversationsStore;
            _advice             = advice;
            _greetingStateStore = greetingStateStore;

            _greetingStateAccessor    = _userState.CreateProperty <GreetingState>(nameof(GreetingState));
            _answersStateAccessor     = _userState.CreateProperty <AnswerState>(nameof(AnswerState));
            _targetSetupStateAccessor = _userState.CreateProperty <TargetSetupState>(nameof(TargetSetupState));
            _dialogStateAccessor      = _conversationState.CreateProperty <DialogState>(nameof(DialogState));

            if (!_services.LuisServices.ContainsKey(LuisConfiguration))
            {
                throw new InvalidOperationException($"The bot configuration does not contain a service type of `luis` with the id `{LuisConfiguration}`.");
            }

            Dialogs = new DialogSet(_dialogStateAccessor);
            Dialogs.Add(new GreetingDialog(_greetingStateAccessor));
            Dialogs.Add(new AnswerDialog(_answersStateAccessor));
            Dialogs.Add(new TargetSetupDialog(_targetSetupStateAccessor));
            Dialogs.Add(new AdviceDialog(_services.LuisServices[LuisConfiguration], _advice, _greetingStateAccessor));
        }
Exemple #2
0
 public StatsCommand(UserState userState, IDisplayAdvice displayAdvice)
 {
     _displayAdvice            = displayAdvice;
     _greetingStateAccessor    = userState.CreateProperty <GreetingState>(nameof(GreetingState));
     _answersStateAccessor     = userState.CreateProperty <AnswerState>(nameof(AnswerState));
     _targetSetupStateAccessor = userState.CreateProperty <TargetSetupState>(nameof(TargetSetupState));
 }
        public AdviceDialog(LuisRecognizer luisRecognizer, IDisplayAdvice advice,
                            IStatePropertyAccessor <GreetingState> greetingStateAccessor) : base(nameof(AdviceDialog))
        {
            _luisRecognizer        = luisRecognizer;
            _advice                = advice;
            _greetingStateAccessor = greetingStateAccessor;

            var waterfallSteps = new WaterfallStep[]
            {
                SummaryStepAsync
            };

            AddDialog(new WaterfallDialog(DisplayAdviceDialog, waterfallSteps));
        }