gpt4 book ai didi

azure - 如何针对特定 LUIS 意图开始对话?

转载 作者:行者123 更新时间:2023-12-03 02:47:21 26 4
gpt4 key购买 nike

这是我的代码:

 async dispatchToTopIntentAsync(context, intent, recognizerResult) {
console.log(context);
switch (intent) {
case 'INeedInsurance':{
const bookingDetails={};
bookingDetails.type="Auto";
return await context.beginDialog(ConfirmAuto)

}

default:
console.log(`Dispatch unrecognized intent: ${ intent }.`);
await context.sendActivity(`Dispatch unrecognized intent: ${ intent }.`);
// await next();
break;
}
}

我需要根据 LUIS 意图结果推送瀑布对话框?你们能帮帮我吗?

最佳答案

尝试使用 session.replaceDialog 而不是 context.beginDialog 并且不需要返回等待,只需按照链接中的示例操作即可:

https://learn.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-dialog-replace?view=azure-bot-service-3.0

编辑:

你也可以检查一下吗

https://learn.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-recognize-intent-luis?view=azure-bot-service-3.0

如何对 LUIS 意图使用react?更准确地说

// Make sure you add code to validate these fields
var luisAppId = process.env.LuisAppId;
var luisAPIKey = process.env.LuisAPIKey;
var luisAPIHostName = process.env.LuisAPIHostName || 'westus.api.cognitive.microsoft.com';

const LuisModelUrl = 'https://' + luisAPIHostName + '/luis/v2.0/apps/' + luisAppId + '?subscription-key=' + luisAPIKey;

// Create a recognizer that gets intents from LUIS, and add it to the bot
var recognizer = new builder.LuisRecognizer(LuisModelUrl);
bot.recognizer(recognizer);

// Add a dialog for each intent that the LUIS app recognizes.
// See https://learn.microsoft.com/bot-framework/nodejs/bot-builder-nodejs-recognize-intent-luis
bot.dialog('GreetingDialog',
(session) => {
session.send('You reached the Greeting intent. You said \'%s\'.', session.message.text);
session.endDialog();
}
).triggerAction({
matches: 'Greeting'
})

bot.dialog('HelpDialog',
(session) => {
session.send('You reached the Help intent. You said \'%s\'.', session.message.text);
session.endDialog();
}
).triggerAction({
matches: 'Help'
})

bot.dialog('CancelDialog',
(session) => {
session.send('You reached the Cancel intent. You said \'%s\'.', session.message.text);
session.endDialog();
}
).triggerAction({
matches: 'Cancel'
})

关于azure - 如何针对特定 LUIS 意图开始对话?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58168202/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com