gpt4 book ai didi

json - DialogFlow Google Assistant Webhook 响应 : "Empty speech response"

转载 作者:行者123 更新时间:2023-12-02 01:03:32 24 4
gpt4 key购买 nike

我在使用 Dialogflow 的 Fulfillment/Webhook 时遇到了一些问题。我创建了一个 Intent,它接受一个参数作为输入(引脚号)。使用 Webhook 调用在服务器端“验证”pin。即,选中“为此意图启用 webhook 调用”。该方法会在验证成功时返回正面消息。

只要我使用 Dialogflow 控制台的“立即尝试”窗口,整个场景就可以完美运行。但是当我尝试在 Google Assistant Simulator 中对其进行测试时,它会响应:

Screen from Actions on Google page > Response

此外,

Screen from Actions on Google page > Validation Errors

这是意图:

Intent screen from DialogFlow Agent page

我已设置为从 Webhook 调用返回的响应:

"messages": [
{
"speech": "Thanks. Your pin has been confirmed.",
"type": 0
}

在此处找到示例响应:https://dialogflow.com/docs/fulfillment

请注意,我已经检查了Error "Empty speech response" .它没有帮助。

最佳答案

这是一个很好的问题,文档看起来对有效回答有点不清楚。

回复 Google 智能助理的消息时,您应该使用 speechdisplayText 参数进行回复。所以等效的响应会是这样的

{
"speech": "Thanks. Your pin has been confirmed.",
"displayText": "Thank you. We have confirmed your PIN and you can proceed."
}

但是,如果您要使用 Actions on Google 功能(卡片、功能请求等)做额外的工作,或者甚至只是在与用户交谈时保持对话打开,那么您将需要使用 data.google 对象以及可能包含一个 simpleResponse 作为 reply 的一部分.这可能看起来像这样:

{
"speech": "Thanks. Your pin has been confirmed.",
"displayText": "Thank you. We have confirmed your PIN and you can proceed.",
"data": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Thanks. Your pin has been confirmed.",
"displayText": "Thank you. We have confirmed your PIN and you can proceed."
}
}
]
}
}
}
}

关于json - DialogFlow Google Assistant Webhook 响应 : "Empty speech response",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49031122/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com