繁体   English   中英

GoogleDialogflow闲聊问题

[英]Google dialogflow small talk issue

我正在使用Google对话框流开发聊天机器人应用程序。 我正在使用节点js客户端https://github.com/dialogflow/dialogflow-nodejs-client-v2来访问我的聊天机器人的数据。 我从对话框流控制台启用了闲聊功能,当我从对话框流Web演示版或控制台本身使用它时,它可以正常工作

在此处输入图片说明

对于同一聊天应用程序,我已经通过使用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);
        }); 

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

在此处输入图片说明

我在这里做错了什么..

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

暂无
暂无

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

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