Esempio n. 1
0
 public Chatbot(BotServices services, ChatbotStateAccessor accessor)
 {
     _accessor = accessor ?? throw new ArgumentNullException(nameof(accessor));
     _services = services ?? throw new System.ArgumentNullException(nameof(services));
     if (!_services.LuisServices.ContainsKey(Constants.LuisKey))
     {
         throw new System.ArgumentException($"Invalid configuration. Please check your '.bot' file for a LUIS service named '{Constants.LuisKey}'.");
     }
 }
Esempio n. 2
0
        public Chatbot(BotServices services, ChatbotStateAccessor accessor)
        {
            _accessor = accessor ?? throw new ArgumentNullException(nameof(accessor));
            _services = services ?? throw new System.ArgumentNullException(nameof(services));
            if (!_services.LuisServices.ContainsKey(Constants.LuisKey))
            {
                throw new System.ArgumentException($"Invalid configuration. Please check your '.bot' file for a LUIS service named '{Constants.LuisKey}'.");
            }

            _dialogs = new DialogSet(_accessor.ConversationDialogState);

            // This array defines how the Waterfall will execute.
            var waterfallSteps = new WaterfallStep[]
            {
                NameStepAsync,
                AcquireNameStepAsync
            };

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            _dialogs.Add(new WaterfallDialog("details", waterfallSteps)); //(dialogId, dialogsInThatDialogId)
            _dialogs.Add(new TextPrompt("name"));                         // (dialogId)
            _dialogs.Add(new NumberPrompt <int>("age"));
            _dialogs.Add(new ConfirmPrompt("confirm"));
        }