我最近从DialogFlowV1升级到了DialogFlowV2。
我看到在displayText和speech参数中没有不同的V2。
如何从webhook实现中发送不同的speech和displayText参数,以便我可以使用DialogFlow Android客户端使用这些值。
从我从V1升级到V2的那天起,我看到displayText参数正在返回安卓的ai.api.sdk中的null
这是我从web钩子上发送的满足答复。
{
"fulfillmentText": "My FulfillmentText",
"fulfillmentMessages": [
{
"text": {
"text": [
"Sample response 1",
"Sample response 2"
]
}
}
]
}我要对上述的回应结构作出哪些改变?
发布于 2018-07-26 05:40:33
您需要在fulfillmentText中传递fulfillmentText文本,在v2 api中传递fulfillmentMessages中的displayText。
{
"fulfillmentText": "This will be speech.",
"fulfillmentMessages": [
{
"text": {
"text": [
"This will be text to be displayed on screen."
]
}
}
]
}如果您没有从web钩子上传递fulfillmentMessages,那么fulfillmentText将显示在屏幕上。
在此页上给出了响应的基本结构。

发送fulfillmentText的示例代码(python)
import json
req = req_you_get_from_webhook_call
res = json.dumps({
'fulfillmentText': 'response from the webhook',
})
return reshttps://stackoverflow.com/questions/51531185
复制相似问题