bot 框架使用 luis - 如何向 luis 发送单个请求
bot framework use luis - how to send a single request to luis
我是 luis 和 bot 框架的新手。到目前为止,我学到的是如何通过 luis 识别的意图触发对话。但我不知道如何在对话框中向 luis 发送消息。我想使用 'builder.EntityRecognizer.findEntity' 方法。我很确定我的 builder.prompts.text 结果只是给我纯文本,而不是 LUIS 识别的文本的意图和实体。但我找不到解决方案,如何向 luis 发送单个请求,以取回我认为 'findEntity' 方法需要的 luis-json 对象。
bot.dialog('reklamation',[
function(session){
session.send('Gerne kümmere ich mich um Ihre Reklamation.');
builder.Prompts.text(session, 'Bitte nennen Sie mir Ihr Anliegen.');
},
function(session, results){
session.dialogData.reklamation = results.response;
session.send('Ich habe Ihre Mitteilung aufgenommen.');
builder.Prompts.text(session, 'Bitte geben Sie mir eine E-Mail-Adresse, unter der wir Ihnen den aktuellen Stand Ihrer Reklamation mitteilen können.');
},
function(session, results){
var email = builder.EntityRecognizer.findEntity(results.entities, 'email');
session.dialogData.email = email;
session.send('Ok! Ich habe folgende Informationen gespeichert:');
session.send('Reklamationsgrund: ' + session.dialogData.reklamation);
session.send('E-Mail: ' + session.dialogData.email);
session.endDialog('Wir werden uns schnellstmöglich mit Ihnen in Verbindung setzen. Vielen Dank für Ihre Anfrage!');
}]).triggerAction({
matches: 'reklamation'});
我很感激任何建议。
在瀑布的第一步中检索实体。意图基本上在比赛中定义。因此,如果您的 LUIS 应用具有意图 "reklamation"
,您的代码将被触发
然后需要将第一个函数的签名更新为:
bot.dialog('reklamation', [
function (session, args, next) {
那么你可以使用:
builder.EntityRecognizer.findEntity(args.intent.entities, 'email');
如果您想要在瀑布的第一步之后手动调用 LUIS,您可以尝试:
builder.LuisRecognizer.recognize("your input", modelUrl, (err, intents, entities) { ... }
查看 LUIS Node.js sample 了解更多信息。
我是 luis 和 bot 框架的新手。到目前为止,我学到的是如何通过 luis 识别的意图触发对话。但我不知道如何在对话框中向 luis 发送消息。我想使用 'builder.EntityRecognizer.findEntity' 方法。我很确定我的 builder.prompts.text 结果只是给我纯文本,而不是 LUIS 识别的文本的意图和实体。但我找不到解决方案,如何向 luis 发送单个请求,以取回我认为 'findEntity' 方法需要的 luis-json 对象。
bot.dialog('reklamation',[
function(session){
session.send('Gerne kümmere ich mich um Ihre Reklamation.');
builder.Prompts.text(session, 'Bitte nennen Sie mir Ihr Anliegen.');
},
function(session, results){
session.dialogData.reklamation = results.response;
session.send('Ich habe Ihre Mitteilung aufgenommen.');
builder.Prompts.text(session, 'Bitte geben Sie mir eine E-Mail-Adresse, unter der wir Ihnen den aktuellen Stand Ihrer Reklamation mitteilen können.');
},
function(session, results){
var email = builder.EntityRecognizer.findEntity(results.entities, 'email');
session.dialogData.email = email;
session.send('Ok! Ich habe folgende Informationen gespeichert:');
session.send('Reklamationsgrund: ' + session.dialogData.reklamation);
session.send('E-Mail: ' + session.dialogData.email);
session.endDialog('Wir werden uns schnellstmöglich mit Ihnen in Verbindung setzen. Vielen Dank für Ihre Anfrage!');
}]).triggerAction({
matches: 'reklamation'});
我很感激任何建议。
在瀑布的第一步中检索实体。意图基本上在比赛中定义。因此,如果您的 LUIS 应用具有意图 "reklamation"
,您的代码将被触发然后需要将第一个函数的签名更新为:
bot.dialog('reklamation', [
function (session, args, next) {
那么你可以使用:
builder.EntityRecognizer.findEntity(args.intent.entities, 'email');
如果您想要在瀑布的第一步之后手动调用 LUIS,您可以尝试:
builder.LuisRecognizer.recognize("your input", modelUrl, (err, intents, entities) { ... }
查看 LUIS Node.js sample 了解更多信息。