Exemple #1
0
        private static async Task <DialogTurnResult> PromptSwitchAsync(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            try
            {
                var activityPrompt = new Activity("ActivityPrompt", "testevent");
                var testSkill      = new EnhancedBotFrameworkSkill
                {
                    AppId         = "Test",
                    Name          = "Test",
                    Description   = "Test",
                    Id            = "Test",
                    SkillEndpoint = new Uri("http://test"),
                };

                return(await sc.PromptAsync(nameof(SwitchSkillDialog), new SwitchSkillDialogOptions(activityPrompt, testSkill), cancellationToken));
            }
            catch (SkillException exc)
            {
                return(new DialogTurnResult(DialogTurnStatus.Cancelled, exc.Message));
            }
            catch (Exception ex)
            {
                return(new DialogTurnResult(DialogTurnStatus.Cancelled, ex.Message));
            }
        }
Exemple #2
0
        public TeamsSkillDialog(ConversationState conversationState, SkillHttpClient skillClient, EnhancedBotFrameworkSkill skill, IConfiguration configuration, Uri skillHostEndpoint)
            : base(skill?.Id)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _botId = configuration.GetSection(MicrosoftAppCredentials.MicrosoftAppIdKey)?.Value;
            if (string.IsNullOrWhiteSpace(_botId))
            {
                throw new ArgumentException($"{MicrosoftAppCredentials.MicrosoftAppIdKey} is not in configuration");
            }

            _skillHostEndpoint = skillHostEndpoint;
            _skillClient       = skillClient ?? throw new ArgumentNullException(nameof(skillClient));
            _skill             = skill ?? throw new ArgumentNullException(nameof(skill));
            _conversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState));
        }
Exemple #3
0
 private async Task SwitchSkillPrompt(DialogContext innerDc, EnhancedBotFrameworkSkill identifiedSkill)
 {
     var prompt = _templateEngine.GenerateActivityForLocale("SkillSwitchPrompt", new { Skill = identifiedSkill.Name });
     await innerDc.BeginDialogAsync(_switchSkillDialog.Id, new SwitchSkillDialogOptions(prompt, identifiedSkill));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SwitchSkillDialogOptions"/> class.
 /// </summary>
 /// <param name="prompt">The <see cref="Activity"/> to display when prompting to switch skills.</param>
 /// <param name="skill">The <see cref="EnhancedBotFrameworkSkill"/> for the new skill.</param>
 public SwitchSkillDialogOptions(Activity prompt, EnhancedBotFrameworkSkill skill)
 {
     Prompt = prompt;
     Skill  = skill;
 }