简体   繁体   中英

BOT framework - progress message

I have created BOT framework in C# and succeeded on it, I want to enable the following feature:

One of my Intent Utterance has to hit the API which takes a while to return the result set.. So i want to handle the wait time in my BOT saying that 'Please hold on a moment , I am getting the results'

How to handle this in the code? Here is my code snippet:

public async Task GetClassListIntent(IDialogContext context, LuisResult result)
{
    try
    {
        var message = context.MakeMessage();

        ClassService classService = new ClassService();
        IList< Result> Results = await classService.GetResults(criteria);

        if (Results != null && Results.Count > 0)
        {
            foreach (var classresult in Results)
            {
                var attachment = Card.GetClassSearchResult(classresult);

                message.Attachments.Add(attachment);
            }
            message.AttachmentLayout = AttachmentLayoutTypes.Carousel;
            await context.PostAsync(message);
        }
        else
        {
            await context.PostAsync("No results found. Please provide more search details ");
            await context.PostAsync(message);
        }
    }
    ...
}

在处理开始时添加进度消息

await context.PostAsync("Please hold on a moment , I am getting the results");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM