我正在使用DialogFlow和Fullfillment开发一个简单的聊天机器人,但无法通过应用程序设置上下文

时间:2019-06-04 12:27:48

标签: node.js dialogflow dialogflow-fulfillment

我正在尝试使用带有NodeJ的DialogFlow构建一个简单的聊天机器人。我可以在DialogFlow控制台上设置后续意图,并且效果很好。但是,我无法通过应用程序设置上下文。

此处的文档:https://cloud.google.com/dialogflow-enterprise/docs/contexts-fulfillment讨论了如何为查询设置上下文,但是到目前为止,我一直没有成功。

请注意,已经在DialogFlow控制台上设置了针对特定意图的后续意图。

尝试:

 const request = {
    session: sessionPath,
    queryInput: {
        text: {
            // The query to send to the dialogflow agent
            text: text,
        //     The language used by the client (en-US)
            languageCode: 'en-US',
        },
     },
    "outputContexts": [{
       "name": "name of my followup intent that I gathered from queryResult.outputContexts",
        "lifespanCount": 2,
        "parameters": {}
    }]  
};
console.log()
const responses = await sessionClient.detectIntent(request);
}

此方法显然失败。我不想使用使用Firebase的嵌入式编辑器,而只想通过我的应用程序来完成此任务。

0 个答案:

没有答案