LUIS を使用してボットを作成しようとしていますが、思ったよりも難しいです。これまでのところ、LUIS アプリケーションを作成し、インテントとエンティティを作成することができました。また、正常に動作するように見えるいくつかの発話を作成しました。
次にボットを作成し、Luis に接続しました。ボットをテストすると、期待どおりに動作しています。さて、楽しい部分です。パラメータを扱いたい。Luis では、アクションをIntentに追加しました:
ご覧のとおり、プロンプトを追加しました。現在、ボットのコードは次のようになっています。
/// <summary>
/// Tries to find the category
/// </summary>
/// <param name="result">The Luis result</param>
/// <param name="alarm"></param>
/// <returns></returns>
public string TryFindCategory(LuisResult result)
{
// Variable for the title
EntityRecommendation title;
// If we find our enenty, return it
if (result.TryFindEntity(PiiiCK.Category, out title))
return title.Entity;
// Default fallback
return null;
}
[LuisIntent("Choose category")]
public async Task ChooseCategory(IDialogContext context, LuisResult result)
{
// Get our category
var category = TryFindCategory(result);
var response = "The category you have chosen is not in the system just yet.";
switch (category)
{
case "camera":
response = $"You need help buying a { category }, is this correct?";
this.started = true;
break;
default:
if (!string.IsNullOrEmpty(category)) response = $"Sorry, PiiiCK does not deal with { category.Pluralise() } just yet.";
break;
}
// Post our response back to the user
await context.PostAsync(response);
// Execute the message recieved delegate
context.Wait(MessageReceived);
}
これで私がどこに向かっているのか推測できると思います。ユーザーがHelp me buy a cameraと入力すると、 Choose category Intent が表示され、正しいエンティティが選択されます。ただし、Help me buyと入力すると、正しい Intent に移動しますが、選択されたEntityはありません。ボットがそれを確認し、LUIS で作成したプロンプトのテキストを使用するようにしたいと考えています。ユーザーがエンティティを選択したときに、そのパラメーターを使用して LUIS に戻りたいと考えています。
これを行う方法がわかりません。これに関するチュートリアルが見つかりません。どんな助けでも大歓迎です(リンクさえも!)