Google dialogflow 闲聊问题

Google dialogflow small talk issue

我正在使用 google 对话流程开发聊天机器人应用程序。我正在使用节点 js 客户端 https://github.com/dialogflow/dialogflow-nodejs-client-v2 来访问我的聊天机器人的数据。我已经从对话流控制台启用了闲聊,当我从对话流网络演示或它自己的控制台使用它时它工作正常

对于同一个聊天应用程序,我已经通过使用 dialogflow 节点 js 客户端实现了 api。

 if (req.body.text) {
        query = req.body.text;
    }
    // Get the city and date from the request
    var request = {
        session: sessionPath,
        queryInput: {
            text: {
                text: query,
                languageCode: languageCode,
            },
        },
    };
    // Send request and log result
    sessionClient
        .detectIntent(request)
        .then(responses => {
            console.log('Detected intent');
            const result = responses[0].queryResult;
            console.log(`  Query: ${result.queryText}`);
            console.log(`  Response: ${result.fulfillmentText}`);
            if (result.intent) {
                res.json({ "text": result.fulfillmentText });
            } else {
                res.json({ 'fulfillmentText': "No intent matched" });
                console.log(`  No intent matched.`);
            }
        })
        .catch(err => {
            console.error('ERROR:', err);
        }); 

我没有得到我想要的结果。相反,它有不同的意图

我在这里做错了什么..

在 Dialogflow 代理的 Small Talk 部分中定义的查询将没有关联的意图。如果有匹配的意图,那么您不应该真正将该查询添加到 Small Talk 中。因此,由于没有匹配的意图,Dialogflow 节点库将 return 一个不匹配的意图。