简体   繁体   中英

Google dialogflow small talk issue

i am developing chat bot application with google dialog flow. i am using node js client https://github.com/dialogflow/dialogflow-nodejs-client-v2 to access the data of my chat bot. 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

在此处输入图片说明

for the same chat application i have implemented a api by using dialogflow node js client.

 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. If there was a matching intent, then you shouldn't have really added that query into Small Talk. Therefore, since there is not matching intent, the Dialogflow Node library will return an unmatched intent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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