use*_*376 5 node.js botframework azure-language-understanding
我使用LUIS.ai打算使用A和B. 在意图A我builder.Prompts.text用来问用户几个问题.然而,有时取决于答案,它会切换到意图B.我猜它恰好与我的意图B匹配,即使我认为它不应该.有没有办法防止这种情况发生?如果我正在通过意图A的对话框,我不希望任何其他意图的中断,直到我完成.这是我的代码示例.
bot.dialog('A', [
function (session, args, next) {
...
},
function (session, args, next) {
...
},
function (session, args) {
...
}
]).triggerAction({
matches: 'A'
});
bot.dialog('B', [
function (session, args, next) {
...
},
function (session, args, next) {
...
},
function (session, args) {
...
}
]).triggerAction({
matches: 'B'
});
Run Code Online (Sandbox Code Playgroud)
这就是你要做triggerAction的事情.它们可以非常方便地保持对话框打开(http://www.pveller.com/smarter-conversations-part-2-open-dialogs)但在你的情况下它们会妨碍你.
如果将对话框置于其下,则可以使对话框免受全局路由系统的影响IntentDialog.如果您所做的只是A和B,那么这将是您的代码的不可中断的等价物:
const intents = new builder.IntentDialog({
recognizers: [
new builder.LuisRecognizer(process.env.LUIS_ENDPOINT)
]
});
intents.matches('A', 'A');
intents.matches('B', 'B');
bot.dialog('/', intents);
bot.dialog('A', []);
bot.dialog('B', []);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
947 次 |
| 最近记录: |