请参阅此链接https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-recognize-intent-luis
我拿了这段代码:
// CreateNote dialog
bot.dialog('CreateNote', [
function (session, args, next) {
// Resolve and store any Note.Title entity passed from LUIS.
var intent = args.intent;
var title = builder.EntityRecognizer.findEntity(intent.entities, 'Note.Title');
var note = session.dialogData.note = {
title: title ? title.entity : null,
};
我不明白的是'CreateNote'
re在本节中的内容是什么?
并参考这一行:
var title = builder.EntityRecognizer.findEntity(intent.entities, 'Note.Title');
假设我的意图名称是calendar.add
,我的实体名称calendar.location
将使intent.entities calendar.add.calendar.location
产生任何混淆。
这是对话框的内部标识符,可以在必要时引用。
关于第二部分,我认为它不会造成混淆,但是如果你两周后再回到这个代码,那么你会抓住你的想法为什么这样命名,所以它更像是物流类在我看来,这件事。
取自官方https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-manage-conversation-flow。 'CreateNote'是对话框的标识符,可以像这样使用:
var inMemoryStorage = new builder.MemoryBotStorage();
var bot = new builder.UniversalBot(connector,
function (session) {
session.send("Welcome");
session.beginDialog('perroDialog'); //Use beginDialog with the
//dialog identifier for starting perroDialog
}
).set('storage', inMemoryStorage); // Register in-memory storage
//--------------------------DIALOGS WATERFALL------------------------
bot.dialog('perroDialog',
function (session) {
session.send('You started perroDialog');
session.endDialog(); //Back to / dialog (UniversalBot callback)
});