根据谷歌dialogflow cx文档:https://cloud.google.com/dialogflow/cx/docs/concept/parameter https://cloud.google.com/dialogflow/cx/docs/concept/parameter
https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/QueryParameters https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/QueryParameters
单击以显示参考 https://i.stack.imgur.com/NOhQJ.png我知道我们可以使用 api 来设置会话参数。所以我想通过API方式将参数传递给webhook。
步骤1:前端,使用Detectintent() API,填写queryParams项。
步骤2:GoogleDialogflowCX服务器将设置参数作为会话参数。
第三步:Webhook接收google端函数调用。我们可以从http请求中找到所有的session参数。
就我而言,我只能接收 DialogFlow Agent 中设置的变量,但没有收到通过 detectorintent() API 设置的任何参数。我想我一定做错了什么,谁能告诉我该怎么办?谢谢。
我的代码如下(Nodejs代码):
const sessionPath = client.projectLocationAgentSessionPath(
projectId,
location,
agentId,
sessionId
);
var mapParameters = new Map([['Michael', 95], ['Bob', 75], ['Tracy', 85]]);
const request = {
session: sessionPath,
"queryInput": {
"text": {
"text": query,
},
languageCode,
},
'queryParams': {
'timeZone': 'America/Los_Angeles',
'parameters': {
"fields":mapParameters
}
},
};
const [response] = await client.detectIntent(request);