internal static async Task ReplyWithNoResults(ITurnContext context, string utterance) { IMessageActivity activity = context.Activity.CreateReply(); activity.Text = "There were no results found for \"" + utterance + "\"."; activity.SuggestedActions = HeroCardUtility.FollowupSuggestions(); await context.SendActivityAsync(activity); }
public static async Task ReplyWithHelp(ITurnContext context) { IMessageActivity activity = context.Activity.CreateReply(); activity.Text = $"I can retrieve cognitive fields from Azure Search. To start a new search, respond \"search\""; activity.SuggestedActions = HeroCardUtility.InitialSuggestions(); await context.SendActivityAsync(activity); }
public static async Task ReplyWithConfused(ITurnContext context) { // Add a response for the user if Regex doesn't know // What the user is trying to communicate IMessageActivity activity = context.Activity.CreateReply(); activity.Text = $"I'm sorry, I don't understand."; activity.SuggestedActions = HeroCardUtility.InitialSuggestions(); await context.SendActivityAsync(activity); }
public void Apply <T>(ref IMessageActivity activity, string prompt, IReadOnlyList <T> options, IReadOnlyList <string> descriptions = null) { if (options is IList <SearchHit> hits) { List <CardAction> cardButtons = new List <CardAction>(); var cards = hits.Select(h => { var card = new HeroCard { Title = WebUtility.UrlDecode(h.FileName).Replace(' ', '_'), Text = h.Description, Buttons = new List <CardAction> { new CardAction() { Value = h.DocumentUrl, Type = "openUrl", Title = "Open Document" } } }; if (h.IsImage) { card.Images = new List <CardImage> { new CardImage(h.DocumentUrl) }; } return(card); }); activity.AttachmentLayout = AttachmentLayoutTypes.Carousel; activity.Attachments = cards.Select(c => c.ToAttachment()).ToList(); activity.SuggestedActions = HeroCardUtility.FollowupSuggestions(); activity.Text = prompt; } }