简体   繁体   English

GoogleDialogflow闲聊问题

[英]Google dialogflow small talk issue

i am developing chat bot application with google dialog flow. 我正在使用Google对话框流开发聊天机器人应用程序。 i am using node js client https://github.com/dialogflow/dialogflow-nodejs-client-v2 to access the data of my chat bot. 我正在使用节点js客户端https://github.com/dialogflow/dialogflow-nodejs-client-v2来访问我的聊天机器人的数据。 i have enabled small talk from the dialog flow console and it works fine when i use it from the dialog flow web demo or the console it self 我从对话框流控制台启用了闲聊功能,当我从对话框流Web演示版或控制台本身使用它时,它可以正常工作

在此处输入图片说明

for the same chat application i have implemented a api by using dialogflow node js client. 对于同一聊天应用程序,我已经通过使用dialogflow node 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);
        }); 

there i dont get the result i want. 那里我没有得到我想要的结果。 instead it goes to a different intent 相反,它有不同的意图

在此处输入图片说明

what i have done incorrectly here.. 我在这里做错了什么..

Queries defined in Small Talk section of your Dialogflow agent will not have an associated intent. 在Dialogflow代理的“闲聊”部分中定义的查询将没有关联的意图。 If there was a matching intent, then you shouldn't have really added that query into Small Talk. 如果有匹配的意图,那么您不应该将该查询真正添加到Small Talk中。 Therefore, since there is not matching intent, the Dialogflow Node library will return an unmatched intent. 因此,由于没有匹配的意图,因此Dialogflow节点库将返回不匹配的意图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM