Пример #1
0
        private async Task <DialogTurnResult> EstablishMandatoryCategoriesAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var state = await _luisRootDialogStateAccessor.GetAsync(stepContext.Context, () => new LuisRootDialogState());

            // Get mandatory categories
            state.MandatoryCategories = new List <string>();
            foreach (var entity in state.Entities)
            {
                var mandCats = await _tableStore.GetMandatoryCategories(entity.Value);

                foreach (var mandCat in mandCats)
                {
                    state.MandatoryCategories.Add(mandCat);
                }
            }

            // Save state
            await _luisRootDialogStateAccessor.SetAsync(stepContext.Context, state);

            // Next waterfall step
            return(await stepContext.NextAsync(cancellationToken : cancellationToken));
        }