使用QnA Maker Bot Framework识别器(Node JS)的“开始"对话框

问题描述:

我想知道是否可以使用QnA Maker识别器在与机器人进行聊天的开始时传递欢迎消息",而模型不会将其识别为要发送给模型的消息.我正在使用最新的Node.js API.

I was wondering if one can pass a "Welcome Message" on the beginning of a chat with a bot using QnA Maker recognizer without the model recognizing it as message to send to the model. I'm using the latest Node.js API.

var intents = new builder_cognitiveservices.QnAMakerDialog({
                    recognizers: [recognizer],
                    defaultMessage: 'Sorry. I didnt understand',
                    qnaThreshold: 0.3}
    );
    bot.dialog('/', [
        function(session){
            session.beginDialog('welcome');
        },
        function(session){
            session.beginDialog('dialog');
        }
    ]);

    bot.dialog('welcome', [
        function (session) {
            // Send a greeting and show help.
            session.send("Hi! How can I help you?");
            session.endDialog();
        }
    ]);

    bot.dialog('dialog', intents);

就像这样,我的机器人正在发送session.send("Hi! How can I help you?"); QnA模型并回答对不起.我不明白".

Like this, my bot is sending the session.send("Hi! How can I help you?"); to the QnA Model and replying "Sorry. I didnt understand".

使用 LUIS ,我仅使用QnAMakerDialog时就没有此问题.

With LUIS I don't have this issue only with the QnAMakerDialog.

有人知道如何解决吗?

我认为这段代码可以为您提供所需的行为.

I think this code gives you the behavior you're looking for.

bot.dialog('welcome', [
    function (session) {
        // Send a greeting and show help.
        builder.Prompts.text(session, "Hi! How can I help you?");
    }
]);

我认为这是失败的原因,因为session.send后跟session.endDialog并不是在等待用户,而是失败了.

I think it's falling through because session.send followed by session.endDialog is not waiting for the user and it falls through.