Exemplo n.º 1
0
        public QnABot(IConfiguration configuration, ILogger <QnABot> logger, IHttpClientFactory httpClientFactory,
                      ConversationState conversationState, UserState userState, IBotServices botServices)
        {
            _configuration     = configuration;
            _logger            = logger;
            _httpClientFactory = httpClientFactory;

            BotServices = (BotServices)botServices;
            if (botServices.QnAMakerService == null)
            {
                _logger.LogError("Cannot use QNAMakerService");
                System.Environment.Exit(-1);
            }

            ConversationState = conversationState;
            UserState         = userState;

            //active learning
            // QnA Maker dialog options
            QnaMakerOptions = new QnAMakerOptions
            {
                Top            = 3,
                ScoreThreshold = 0.03F,
            };

            _dialogs = new DialogSet(ConversationState.CreateProperty <DialogState>(nameof(DialogState)));

            _dialogHelper = new DialogHelper(botServices);

            _dialogs.Add(_dialogHelper.QnAMakerActiveLearningDialog);
        }
Exemplo n.º 2
0
        public MainDialog(IConfiguration configuration, IStatePropertyAccessor <AuthenticatedUser> AuthenticatedUserAccessor, IBotServices botServices, Intents intents)
            : base(nameof(MainDialog), configuration["ConnectionName"])
        {
            Configuration = configuration;
            _AuthenticatedUserAccessor = AuthenticatedUserAccessor;
            _botServices = botServices;
            Intents      = intents;


            AddDialog(new OAuthPrompt(
                          nameof(OAuthPrompt),
                          new OAuthPromptSettings
            {
                ConnectionName = ConnectionName,
                Text           = "Before we start, I would need from you to verify your account.",
                Title          = "Verify Account",
                Timeout        = 300000, // User has 5 minutes to login (1000 * 60 * 5)
            }));

            //AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));

            AddAllPossibleDialogs();

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                PromptStepAsync,
                LoginStepAsync,
                StartProcessingIntents,
                EndProcessingIntents
            }));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }
Exemplo n.º 3
0
        public MainDialog(IBotServices botServices, TechnicalAssistanceDialog technicalAssistance,
                          OrderProductDialog orderProduct, AskUserInfoDialog infoDialog, ConversationState conversationState, ConfirmOrderDialog confirmOrderDialog,
                          AddProductInfoDialog addProductInfoDialog, UserValidationDialog userValidationDialog, IConfiguration configuration,
                          UserController userController, NotifyController notifyController, IPrestashopApi prestashopApi)
            : base(nameof(MainDialog))
        {
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(orderProduct);
            AddDialog(technicalAssistance);
            AddDialog(infoDialog);
            AddDialog(confirmOrderDialog);
            AddDialog(addProductInfoDialog);
            AddDialog(userValidationDialog);
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                WelcomeStepAsync,
                InitialStepAsync,
                DispatchStepAsync,
                FinalStepAsync,
            }));

            InitialDialogId       = nameof(WaterfallDialog);
            BotServices           = botServices;
            UserController        = userController;
            NotifyController      = notifyController;
            PrestashopApi         = prestashopApi;
            _conversationAccessor = conversationState.CreateProperty <ConversationData>(nameof(ConversationData));
            Configuration         = configuration;
        }
Exemplo n.º 4
0
 //private const string Message = "Humm... Searching...😊";
 public QnADialog(IConfiguration configuration, IBotServices services) : base(nameof(QnADialog))
 {
     //var waterfallSteps = new WaterfallStep[]
     //{
     //    //QuestionsStepAsync,
     //    CallGenerateAnswerAsync,
     //    IntroStepAsync,
     //    QuestionConfirmStepAsync,
     //    //SummaryStepAsync,
     //    //DisplayQnAResult,
     //};
     //AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
     AddDialog(new TextPrompt(nameof(TextPrompt)));
     AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));
     AddDialog(new NumberPrompt <int>(nameof(NumberPrompt <int>)));
     AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
     AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
     {
         CallGenerateAnswerAsync,
         //IntroStepAsync,
         //QuestionConfirmStepAsync,
     }));
     // The initial child Dialog to run.
     _services       = services ?? throw new ArgumentNullException(nameof(services));
     InitialDialogId = nameof(WaterfallDialog);
     //Step = nameof(CallGenerateAnswerAsync);
 }
Exemplo n.º 5
0
        //private const string InfoMessage = "Here's what I can do to help ... 😊 ";

        // Dependency injection uses this constructor to instantiate MainDialog
        public MainDialog(ILogger <MainDialog> logger, IConfiguration configuration, IBotServices service, LuisRecongnizer luisRecognizer)
            : base(nameof(MainDialog))
        {
            Logger          = logger;
            Configuration   = configuration;
            Service         = service;
            _luisRecognizer = luisRecognizer;
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));
            AddDialog(new AddDialog(configuration));
            AddDialog(new QnADialog(configuration, service));
            //AddDialog(new QnAMakerBaseDialog(configuration, service));
            AddDialog(new LuisDialog(configuration, luisRecognizer));
            AddDialog(new SmartDialog(configuration, service));
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                //IntroStepAsync,
                IntroStepAsync,
                ActStepAsync,
                //LuisStepAsync,
                // FinalStepAsync,
                // FinalStepAsync,
            }));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }
Exemplo n.º 6
0
 public QnABot(ConversationState conversationState, UserState userState, T dialog, IBotServices botServices, ILogger <QnABot <T> > logger)
 {
     ConversationState = conversationState;
     UserState         = userState;
     Dialog            = dialog;
     _botServices      = botServices;
 }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 public DispatchBot(IBotServices botServices, ILogger <DispatchBot> logger, ConversationState conversationState, UserState userState)
 {
     _logger            = logger;
     _botServices       = botServices;
     _conversationState = conversationState;
     _userState         = userState;
 }
Exemplo n.º 9
0
        public LuisRootDialog(UserState userState, ITableStore tableStore, IBotServices botServices)
            : base(nameof(LuisRootDialog))
        {
            _luisRootDialogStateAccessor = userState.CreateProperty <LuisRootDialogState>(nameof(LuisRootDialogState));
            _tableStore = tableStore;

            // Add child dialogs
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                GetLuisResultAsync,
                GetEntitiesAsync,
                EstablishMandatoryCategoriesAsync,
                PromptCpuCategoryAsync,
                HandleCpuCategoryAsync,
                PromptColourCategoryAsync,
                HandleColourCategoryAsync,
                PromptConnectivityCategoryAsync,
                HandleConnectivityCategoryAsync,
                PromptMemoryCategoryAsync,
                HandleMemoryCategoryAsync,
                PromptProductCategoryAsync,
                HandleProductCategoryAsync,
                PromptProductFamilyCategoryAsync,
                HandleProductFamilyCategoryAsync,
                PromptStorageCategoryAsync,
                HandleStorageCategoryAsync,
                ShowLinkAsync,
                FinalStepAsync,
            }));
            AddDialog(new TextPrompt(nameof(TextPrompt)));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
            AddDialog(new ShowLinkDialog(nameof(ShowLinkDialog), botServices));
        }
Exemplo n.º 10
0
 public VisionAlarmBot(IBotServices botServices, ILogger <VisionAlarmBot> logger, ConcurrentDictionary <string, ConversationReference> conversationReferences, IConfiguration configuration, IHttpClientFactory clientFactory)
 {
     _logger                 = logger;
     _botServices            = botServices;
     _conversationReferences = conversationReferences;
     _configuration          = configuration;
     _clientFactory          = clientFactory;
 }
Exemplo n.º 11
0
 public DispatchWeatherBot(ConversationState conversationState, UserState userState, IConfiguration configuration, IBotServices botServices, ILogger <DispatchWeatherBot> logger)
 {
     _conversationState = conversationState;
     _userState         = userState;
     _configuration     = configuration;
     _logger            = logger;
     _botServices       = botServices;
 }
Exemplo n.º 12
0
 public Mediator(DatabaseOperator databaseOperator, IBotServices telegramOperator, MessageHandler messageHandler)
 {
     this.databaseOperator = databaseOperator;
     this.telegramOperator = telegramOperator;
     this.telegramOperator.AddMediator(this);
     this.messageHandler = messageHandler;
     this.messageHandler.AddMediator(this);
 }
Exemplo n.º 13
0
 public DialogBot(ConversationState conversationState, UserState userState, T dialog, ILogger <DialogBot <T> > logger, IBotServices botServices)
 {
     ConversationState = conversationState;
     UserState         = userState;
     Dialog            = dialog;
     Logger            = logger;
     _botServices      = botServices;
 }
Exemplo n.º 14
0
 public QnABot(ConversationState conversationState, UserState userState, T dialog, IBotServices services, IConfiguration configuration)
 {
     ConversationState = conversationState;
     UserState         = userState;
     Dialog            = dialog;
     _services         = services;
     //_config = configuration;
 }
Exemplo n.º 15
0
 public DialogBot(ConversationState conversationState, UserState userState, T dialog, ILogger <DialogBot <T> > logger, IBotServices botServices)
 {
     this.conversationState = conversationState;
     this.userState         = userState;
     this.dialog            = dialog;
     this.logger            = logger;
     this.botServices       = botServices;
 }
Exemplo n.º 16
0
 public QnAMakerBaseDialog(IConfiguration configuration, IBotServices services) : base()
 {
     this._services              = services;
     _defaultNoAnswer            = configuration.GetValue <string>("DefaultNoAnswer");
     _defaultCardTitle           = configuration.GetValue <string>("DefaultCardTitle");
     _defaultCardNoMatchText     = configuration.GetValue <string>("DefaultCardNoMatchText");
     _defaultCardNoMatchResponse = configuration.GetValue <string>("DefaultCardNoMatchResponse");
 }
Exemplo n.º 17
0
 public ChatBot(IBotServices botServices, ConversationState conversationState, UserState userState, T dialog, ILogger <ChatBot <T> > logger)
 {
     ConversationState = conversationState;
     UserState         = userState;
     Dialog            = dialog;
     Logger            = logger;
     this.botServices  = botServices;
 }
Exemplo n.º 18
0
 public DispatchBot(IBotServices botServices, ILogger <DispatchBot> logger, UserState userState, MicrosoftTranslator translator)
 {
     _logger             = logger;
     _botServices        = botServices;
     _userState          = userState ?? throw new NullReferenceException(nameof(userState));
     _translator         = translator ?? throw new ArgumentNullException(nameof(translator));
     _languagePreference = userState.CreateProperty <string>("LanguagePreference");
 }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QnAMakerBaseDialog"/> class.
 /// Dialog helper to generate dialogs.
 /// </summary>
 /// <param name="services">Bot Services.</param>
 public QnAMakerBaseDialog(IBotServices services, IConfiguration configuration) : base()
 {
     this._services = services;
     if (!string.IsNullOrWhiteSpace(configuration["DefaultAnswer"]))
     {
         this.DefaultAnswer = configuration["DefaultAnswer"];
     }
 }
Exemplo n.º 20
0
 public RandomSetCardPlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 21
0
        public DispatchBot(IBotServices botServices, ConversationState conversationState, UserState userState, UserProfileDialog userProfileDialog, ILogger <DispatchBot> logger)

        {
            _logger            = logger;
            _botServices       = botServices;
            _userProfileDialog = userProfileDialog;
            _conversationState = conversationState;
            _userState         = userState;
        }
Exemplo n.º 22
0
 public ImgHiresCommand(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 23
0
 public CoinFlipPlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 24
0
 public CardPricePlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 25
0
 public GetSetPlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 26
0
 public RulingPlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 27
0
 public ScryFallImgPlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 /// Dialog helper to generate dialogs
 /// </summary>
 /// <param name="services">Bot Services</param>
 public DialogHelper(IBotServices services)
 {
     QnAMakerActiveLearningDialog = new WaterfallDialog(ActiveLearningDialogName)
                                    .AddStep(CallGenerateAnswer)
                                    .AddStep(FilterLowVariationScoreList)
                                    .AddStep(CallTrain)
                                    .AddStep(DisplayQnAResult);
     _services = services;
 }
 public TappedOutComboDecksPlugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
 public TappedOutLatestTop8Plugin(
     IBotServices services,
     BotConfig config
     )
     : base(
         services,
         config)
 {
 }
Exemplo n.º 31
0
 public KarmaModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 32
0
 public GuidesModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 33
0
 public RadioModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 34
0
 public BotModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 35
0
 public ToolsModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 36
0
 public StatsModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 37
0
 public DefenceModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 38
0
 public NewsModule(IBotServices botServices)
 {
     _botServices = botServices;
 }
Exemplo n.º 39
0
 public Bot(DiscordClient client, CommandService commandService, IBotServices botServices)
 {
     _client = client;
     _commandService = commandService;
     _botServices = botServices;
 }
Exemplo n.º 40
0
 public AdminModule(IBotServices botServices)
 {
     _botServices = botServices;
 }