Building a simple customer service BOT, have designed the LUIS model and it works great when the order no. is provided in the first step itself. for eg. whats the status of my order ABC0898787 ? where intent is detected correctly and ABC0898787 is identified as the entity.
However, need to adapt the bot to have a conversation as follows:
User: whats the status of my order
Bot: please provide the order no
User: (It is ABC0986767) or (ABC0986767)
Bot should be able to map the number to entity and process the request.
the code for intent method, whats the best way to integrate the second step without setting up the LUIS model to take single words as entity ?
[LuisIntent("OrderStatus")]
public async Task OrderStatus(IDialogContext context, LuisResult result)
{
var returnMsg = "You wanted to check the order status";
var orderStatus = "Dispatched";
var deliveryDate = DateTime.Now.AddDays(3);
var entities = new List<EntityRecommendation>(result.Entities);
if(entities.Any((entity)=> entity.Type == "Order"))
{
var orderEntity = entities.Where((entity) => entity.Type == "Order").FirstOrDefault();
var resolutionStr = orderEntity.Entity;
if(!string.IsNullOrEmpty(resolutionStr))
{
returnMsg = "Your order " + resolutionStr + " is " + orderStatus + " and expected to arrive " + deliveryDate.Humanize();
}
}
await context.PostAsync(returnMsg);
context.Wait(MessageReceived);
}