public UnexFacilitiesDialog(string dialogId, IUnexFacilitiesService unexFacilititesService, IEnumerable <WaterfallStep> steps = null) : base(dialogId)
        {
            _lgEngine = Templates.ParseFile(Path.Combine(new string[] { ".", ".", "Resources", "UnexFacilitiesDialog.lg" }));
            _unexFacilitiesService = unexFacilititesService;

            ChoicePrompt choicePrompt = new ChoicePrompt(nameof(ChoicePrompt));

            choicePrompt.ChoiceOptions = new ChoiceFactoryOptions {
                IncludeNumbers = false
            };
            choicePrompt.RecognizerOptions = new FindChoicesOptions {
                AllowPartialMatches = true
            };
            AddDialog(choicePrompt);

            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroFacilitiesQuestionStepAsync,
                IntermediateFacilitiesAnswerStepAsync,
                EndQuestionStepAsync,
            }));

            InitialDialogId = nameof(WaterfallDialog);
        }
Exemple #2
0
        public MainLuisDialog(
            BotServices botServices,
            ITeacherService teacherService,
            IOpenDataService openDataService,
            ISearchService searchService,
            ISpellCheckService spellCheckService,
            IUnexFacilitiesService unexFacilitiesService,
            string dialogId = null,
            IEnumerable <WaterfallStep> steps = null) : base(dialogId ?? nameof(MainLuisDialog))
        {
            string fullPath = Path.Combine(new string[] { ".", ".", "Resources", "MainLuisDialog.lg" });

            _lgEngine = Templates.ParseFile(fullPath);

            _services = botServices ?? throw new ArgumentNullException(nameof(botServices));

            if (!_services.LuisServices.ContainsKey(LuisServiceConfiguration.LuisKey))
            {
                throw new ArgumentException($"La configuración no es correcta. Por favor comprueba que existe en tu fichero '.bot' un servicio LUIS llamado '{LuisServiceConfiguration.LuisKey}'.");
            }

            AddDialog(new LanguageNotValidDialog(nameof(LanguageNotValidDialog)));
            AddDialog(new GoodByeDialog(nameof(GoodByeDialog)));
            AddDialog(new HelpDialog(nameof(HelpDialog)));
            AddDialog(new GratitudeDialog(nameof(GratitudeDialog)));
            AddDialog(new NegationDialog(nameof(NegationDialog)));
            AddDialog(new QuestionDialog(nameof(QuestionDialog), botServices, spellCheckService, searchService));
            AddDialog(new SubjectDialog(nameof(SubjectDialog), openDataService));
            AddDialog(new TeacherDialog(nameof(TeacherDialog), teacherService));
            AddDialog(new UnexFacilitiesDialog(nameof(UnexFacilitiesDialog), unexFacilitiesService));

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
                ActStepAsync,
                FinalStepAsync,
            }));

            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));

            InitialDialogId = nameof(WaterfallDialog);
        }