我有一个带有几个 LUIS 意图的 LuisDialog。在其中一些意图中,我可能需要向用户询问更多信息。在这些情况下,我尝试使用 PromptDialog 或 PromptString。
我已经试过这个:
[LuisIntent("MyIntent")]
public async Task MyIntent(IDialogContext context, LuisResult result)
{
if (result.Entities.Count == 0)
{
PromptDialog.Text(context, AfterUserInputSymbol, "Message to the user", "Try again message", 2);
result.Entities[0].Entity = userSymbol;
}
//some other code
context.Wait(MessageReceived);
}
private async Task AfterUserInputSymbol(IDialogContext context, IAwaitable<string> result)
{
userSymbol = await result;
context.Wait(MessageReceived);
}
还有这个:
[LuisIntent("MyIntent")]
public async Task MyIntent(IDialogContext context, LuisResult result)
{
if (result.Entities.Count == 0)
{
PromptString dialog = new PromptString("Message to the user", "Try again message", 2);
context.Call(dialog, AfterUserInputSymbol);
result.Entities[0].Entity = userSymbol;
}
//some other code
context.Wait(MessageReceived);
}
private async Task AfterUserInputSymbol(IDialogContext context, IAwaitable<string> result)
{
userSymbol = await result;
context.Wait(MessageReceived);
}
在这两种情况下,用户都不会看到提示,并且 的值userSymbol
会为空。当我调试代码AfterUserInputSymbol
时,只进入到这部分的时间:result.Entities[0].Entity = userSymbol;
如何在 LuisIntent 中提示更多信息?