Пример #1
0
        public Task StartAsync(IDialogContext context)
        {
            try
            {
                // Load QnA Services from database
                // Create the database context first
                SupportBotContext db = new SupportBotContext();
                // Load the available QnA services sets from the database
                var qnaServicesSet = db.Set <QnAMakerService>();
                // Add the QnA service references to the QnA Maker Client
                foreach (var item in qnaServicesSet)
                {
                    client.QnAServices.Add(item);
                }

                context.Wait(MessageReceivedAsync);
            }
            catch (Exception e)
            {
                //TODO Remove
                context.PostAsync(e.Message);
                // If the database isn't available or if there is any other problem, let the user know and end the dialog
                context.PostAsync(Resources.BotTexts.DatebaseNotAvailable);
                context.Done(String.Empty);
            }

            return(Task.CompletedTask);
        }
Пример #2
0
        public Task StartAsync(IDialogContext context)
        {
            try
            {
                // Load QnA Services from Database
                SupportBotContext db = new SupportBotContext();
                var qnaServicesSet   = db.Set <QnAMakerService>();
                foreach (var item in qnaServicesSet)
                {
                    client.QnAServices.Add(item);
                }

                // Display a promt choise with all the different technologies available
                PromptDialog.Choice(context, AfterTechnologySelectedAsync, client.ServiceNames, Resources.BotTexts.CategorySelectionQuestion, Resources.BotTexts.PleaseUseButtons);
            }
            catch (Exception)
            {
                // If the database if not available notify the user
                context.PostAsync(Resources.BotTexts.DatebaseNotAvailable);
                context.Done(String.Empty);
            }

            return(Task.CompletedTask);
        }
Пример #3
0
 public QnAPairsController(SupportBotContext context)
 {
     _context = context;
 }
Пример #4
0
 public QnAMakerServicesController(SupportBotContext context)
 {
     _context = context;
 }