Esempio n. 1
0
        public static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World! This is a console app for testing whatever isn't working. Shouldn't be run normally.");
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", false, true)
                                    .AddJsonFile("appsettings.Development.json", true, true)
                                    .Build();

            var loggerFactory = LoggerFactory.Create(builder =>
            {
                builder.AddConsole();
            });

            var serviceProvider = new ServiceCollection()
                                  .AddDbContext <BastardDBContext>(options => options
                                                                   .UseSqlServer(config.GetConnectionString("DefaultConnection"),
                                                                                 moreOptions => moreOptions.CommandTimeout(120))
                                                                   )
                                  .AddBastardServices(config)
                                  .BuildServiceProvider();

            using (DIBastardBrain trainingModel = new DIBastardBrain(serviceProvider))
            {
                await trainingModel.InitDatabaseAndModel();

                await trainingModel.TrainAndPublishNewModel();
            }
        }
Esempio n. 2
0
        // Dependency injection uses this constructor to instantiate MainDialog
        public MainBastardDialog(BastardRecognizer luisRecognizer, ILogger <MainBastardDialog> logger,
                                 IBotServices botBervices, IServiceScopeFactory scopeFactory, DIBastardBrain brain,
                                 IMemoryCache memoryCache)
            : base(nameof(MainBastardDialog))
        {
            _luisRecognizer = luisRecognizer;
            _botServices    = botBervices;
            _brain          = brain;
            Logger          = logger;
            _cache          = memoryCache;

            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                ShowConditions,
                CheckAccepted,
                IntroStepAsync,
                ActStepAsync,
                ShowQnAInsultAndGetAnother,
                GoRoundAgain
            }));
            AddDialog(new NewInsultQnADialog(brain));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }