我使用创建了一个网络钩子对话流履行根据平台正确返回不同的数据,包括我为另一服务创建的自定义数据。我已经测试了我的网络钩子并且知道如果我更改originalDetectIntentRequest.source
对于我的自定义有效负载中使用的平台,它可以工作。
{
"payload": {
"jokes-api": {
"success": true,
"text": "These are some jokes",
}
},
"outputContexts": []
}
我能够使用对话框流-nodejs-客户端-v2's sessions.detectIntent
得到回应,但履行回来与平台设置为PLATFORM_UNSPECIFIED
,而不是我想要的自定义有效负载。
[{
"responseId": "c56c462f-bb3b-434a-b318-3739f58e6f6d",
"queryResult": {
"fulfillmentMessages": [{
"platform": "PLATFORM_UNSPECIFIED",
"card": {
"buttons": [],
"title": "Jokes",
"subtitle": "These are some jokes",
"imageUri": ""
},
"message": "card"
}],
"queryText": "tell me a joke",
/* ... */
"intent": {
"name": "projects/my-jokes/agent/intents/56887375-3047-4993-8e14-53b20dd02697",
"displayName": "Jokes",
/* ... */
},
"intentDetectionConfidence": 0.8999999761581421,
}
}]
查看我的 webhook 日志,我可以看到originalDetectIntentRequest
对象存在,但源未设置。
{
"responseId": "c56c462f-bb3b-434a-b318-3739f58e6f6d",
"queryResult": {
"queryText": "tell me a joke",
"speechRecognitionConfidence": 0.9602501,
/* ... */
"intent": {
"name": "projects/my-jokes/agent/intents/56887375-3047-4993-8e14-53b20dd02697",
"displayName": "Jokes"
},
/* ... */
},
"originalDetectIntentRequest": {
"payload": {
}
},
"session": "projects/my-jokes/agent/sessions/12345"
}
如何在dialogflow-nodejs-client-v2中设置平台或源以获得所需的响应?