我使用LUIS BOT框架实现了一个简单的工作流程 现在我创建了一个新的LUIS对话框来承载主对话框的子流程。基本上,我想在会话流程上启用LUIS意图操作
我也为子Luis Dialog定义了LUIS Intent,但不幸的是,它甚至没有点击SubLUIS对话框并返回Root对话框。我错过了什么吗?
这是我的示例代码,
MAIN LUIS DIALOG:
public virtual async Task PaymentConfirmationReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
var message = await result; // We've got a message!
// User said 'order', so invoke the New Order Dialog and wait for it to finish.
// Then, call ResumeAfterNewOrderDialog.
// await context.Forward(new OrderDialog(), this.ResumeAfterNewOrderDialog, message, CancellationToken.None);
await context.Forward(
new OrderDialog(),
ResumeAfterNewOrderDialog,
result,
CancellationToken.None);
// User typed something else; for simplicity, ignore this input and wait for the next message.
context.Wait(this.MessageReceived);
}
private async Task ResumeAfterNewOrderDialog(IDialogContext context, IAwaitable<object> result)
{
// Store the value that NewOrderDialog returned.
// (At this point, new order dialog has finished and returned some value to use within the root dialog.)
var resultFromNewOrder = await result;
await context.PostAsync($"New order dialog just told me this: {resultFromNewOrder}");
// Again, wait for the next message from the user.
context.Wait(this.MessageReceived);
}
SUB LUIS DIALOG
[LuisIntent(Intent_Go)]
public async Task ProcessGo(IDialogContext context, LuisResult result)
{
try
{
// var sentiment = await TextAnalyticsService.DetermineSentimentAsync(sentence);
string entities = this.BotEntityRecognition(Intent_PaymentGo, result);
// round number
var roundedScore = result.Intents[0].Score != null ? (Math.Round(result.Intents[0].Score.Value, 2)) : 0;
if (roundedScore > 8)
{
---do some operations---
await context.PostAsync(data.ToString());
context.Wait(MessageReceived);
}
else
{
await context.PostAsync("Ok Fine! Let us know if we can help with any other queries!");
context.Wait(MessageReceived);
}
}
catch(Exception ex)
{
throw ex;
}
}