我正在使用LuisDialog
,我想知道如何使用LuisResult
来检测动作、参数并提示用户输入缺少的参数。我知道LuisResult
已经包含操作和参数,但是我不知道提示用户的最佳方式是什么,或者如何使用contextId
. 我无法在 BotBuilder SDK 或一般网络上找到有关此主题的任何示例。
问问题
243 次
1 回答
1
我的粗略方法是这样的。例如,您期望LuisResult
. 如果它们丢失,您希望提示用户输入它们。
首先,您将检查缺少哪些实体。如果缺少某些内容,请提示用户并将他们的响应重定向到将处理新数据的另一种方法。已经收到的 LuisResult 需要先保存ConversationData
。
var requiredEntities = new List<string>()
{
"builtin.places.place_name",
"builtin.places.place_type"
};
string askForMore = null;
foreach(var entity in requiredEntities)
{
EntityRecommendation temp;
var found = result.TryFindEntity(entity, temp);
if (!found)
{
//Prompt the user for more information
askForMore = entity;
}
}
if (askForMore != null)
{
//TODO: store values from existing LuisResult for later use
//For example, use ConversationData for storage.
context.PostAsync("Please enter value for entity " + askForMore);
context.Wait(AdditionalUserInputReceived);
}
else
{
//do normal stuff
}
FormFlow
这是一种完全手动的方式,我认为通过与 a结合可以实现更多自动化LuisDialog
,但灵活性较低
于 2016-10-31T14:06:34.437 回答