Exemplo n.º 1
0
        public MultiTurnBot(BotServices services, UserState userState, ConversationState conversationState, BotSettings botSettings, IBotIntents botIntents, ILoggerFactory loggerFactory)
        {
            _userState         = userState.CheckNullReference();
            _conversationState = conversationState.CheckNullReference();
            _botSettings       = botSettings.CheckNullReference();
            _botIntents        = botIntents.CheckNullReference();

            // Verify LUIS configuration.
            if (!services.CheckNullReference().LuisServices.ContainsKey(botSettings.LuisConfiguration))
            {
                throw new InvalidOperationException($"The bot configuration does not contain a service type of `luis` with the id `{botSettings.LuisConfiguration}`.");
            }
            _luisRecognizer = services.LuisServices[botSettings.LuisConfiguration];


            _entityStateAccessor = _userState.CreateProperty <EntityState>(nameof(EntityState));
            var dialogStateAccessor = _conversationState.CreateProperty <DialogState>(nameof(DialogState));

            _dialogSet = new BotDialogSet(dialogStateAccessor, _entityStateAccessor, loggerFactory);

            _logger = loggerFactory.CheckNullReference().CreateLogger <MultiTurnBot>();
        }