4
我已經使用LUIS.ai意圖使用A和B.在意圖A中,我使用builder.Prompts.text
來詢問用戶幾個問題。然而,有時候取決於答案,它會轉換爲意圖B.我猜這恰好符合我的意圖B,即使我認爲它不應該。有沒有辦法來防止這種情況發生?如果我正在通過意向A的對話,我不希望任何其他意圖中斷,直到我完成。這是我的代碼的一個例子。Botframework否從其他意圖對話中斷直到用當前意圖對話框完成
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'
});
原因我從切換到''triggerAction'是IntentDialog'使用'cancelAction'能夠取消用戶鍵入「取消/停止」時的對話框。有沒有辦法做到這一點,如果我把我的意圖下的'IntentDialog'? – user3128376
你確定可以用Intent.Dialog的[cancelAction](https://docs.botframework.com/en-us/node/builder/chat-reference/classes/_botbuilder_d_.intentdialog.html#cancelaction)。但是在Pavel的代碼中,他在'intents.matches'中傳入了第二個參數的dialogId。這個dialogId引用了你原來沒有'triggerAction'的同樣的對話框。所以當IntentDialog處理意圖時,它會重定向到目前爲止所使用的內容('UniversalBot.dialog'),允許您繼續使用'cancelAction'。 –
不知道如果我使用它不正確,但當我做'intent.matches('A',[...])。cancelAction(...);'任何時候它符合我的關鍵字'取消'它意味着意圖A的'cancelAction'而不是我的意圖(即意圖B)。我將如何讓它不是全球?我基本上擁有Pavel的功能,但我只想添加'cancelAction'並使其不是全局的。謝謝 – user3128376