Esempio n. 1
0
        /// <summary>
        /// Map Skill slots to what we have in SkillContext.
        /// </summary>
        /// <param name="innerDc">Dialog Contect.</param>
        /// <param name="actionSlots">The Slots within an Action.</param>
        /// <param name="skillContext">Calling Bot's SkillContext.</param>
        /// <returns>A filtered SkillContext for the Skill.</returns>
        private async Task <SkillContext> MatchSkillContextToSlots(DialogContext innerDc, List <Slot> actionSlots, SkillContext skillContext)
        {
            SkillContext slots = new SkillContext();

            if (actionSlots != null)
            {
                foreach (Slot slot in actionSlots)
                {
                    // For each slot we check to see if there is an exact match, if so we pass this slot across to the skill
                    if (skillContext.TryGetValue(slot.Name, out object slotValue))
                    {
                        slots.Add(slot.Name, slotValue);

                        // Send trace to emulator
                        await innerDc.Context.SendActivityAsync(new Activity(type : ActivityTypes.Trace, text : $"-->Matched the {slot.Name} slot within SkillContext and passing to the Skill."));
                    }
                }
            }

            return(slots);
        }