为什么轮播没有显示在控制台模拟器中?
Why is the carousel not showing in the console simulator?
我想弄清楚如何在 DialogFlow 的 webhook 响应中嵌入 Google 操作响应,例如 carousel。
我使用的是 REST 协议的 V2,所以我在 source
字段中填写 ACTIONS_ON_GOOGLE
并且 payload
字段包含指定的 Google Actions 字段(根据 )。我发送以下回复:
{
"fulfillmentText":"This is a carousel.",
"source":"ACTIONS_ON_GOOGLE",
"payload":{
"conversationToken":"",
"expectUserResponse":true,
"expectedInputs":[
{
"inputPrompt":{
"initialPrompts":[
{
"textToSpeech":"This is a carousel."
}
],
"noInputPrompts":[
]
},
"possibleIntents":[
{
"intent":"actions.intent.OPTION",
"inputValueData":{,
"@type":"type.googleapis.com/google.actions.v2.OptionValueSpec"
"carouselSelect":{
"items":[
{
"optionInfo":{
"key":"key1",
"synonyms":[
"Option 1"
]
},
"title":"Option 1",
"description":"Option 2"
},
{
"optionInfo":{
"key":"key2",
"synonyms":[
"Option 2"
]
},
"title":"Option 2",
"description":"Option 2"
}
]
}
}
}
]
}
]
}
}
在控制台中尝试此操作时,没有显示轮播。仅显示文本 This is a carousel.
。供您参考,我没有包括 image
字段,因为根据规范它是可选的,但即使有图像也没有显示轮播。
这很难调试,因为我的 actions.intent.OPTION
意图没有显示在响应选项卡的 possibleIntents[]
数组中。我希望这个 actions.intent.OPTION
意图与 Dialogflow 响应生成的其他意图(例如 assistant.intent.action.TEXT
)合并。
我在这里做错了什么?我是否可能使用 V2 而不是 Dialogflow REST 协议的 V1 搬起石头砸自己的脚?
根据 Prisoner 的初步反馈更新
我尝试了以下响应,但仍然没有得到任何轮播:
{
"fulfillmentText":"Here you go.",
"source":"ACTIONS_ON_GOOGLE",
"payload":{
"expectUserResponse":true,
"richResponse":{
"items":[
{
"simpleResponse":{
"textToSpeech":"Here are your results."
}
}
]
},
"systemIntent":{
"intent":"actions.intent.OPTION",
"data":{
"carouselSelect":{
"items":[
{
"optionInfo":{
"key":"Option1",
"synonyms":[
"Option2"
]
},
"title":"Option3",
"description":"Option4"
},
{
"optionInfo":{
"key":"Option5",
"synonyms":[
"Option6"
]
},
"title":"Option7",
"description":"Option8"
}
]
},
"@type":"type.googleapis.com/google.actions.v2.OptionValueSpec"
}
}
}
}
我还尝试在 Dialogflow 中使用 returns 一个 'hardcoded' 轮播(即没有实现回调)手动创建一个意图,并且这个轮播完美显示。所以我确定控制台配置正确。
我也在将我的回复与 Google Assistant flow with multiple actions_intent_OPTION handlers 中的回复进行比较,但到目前为止没有成功。
你并没有搬起石头砸自己的脚 - 但你却让本来就有点复杂的事情变得更加复杂。有两点需要注意:
更正:确保 payload
与以前的 data
相同,但其他字段已更改格式.
您需要确保模拟器处于 Phone 模式而不是扬声器模式。
详情如下。
记录的 Dialogflow 差异
Dialogflow 响应的 Actions on Google documentation 有点令人困惑。它没有提供完整的示例,只是说 expectedInputs.possibleIntents
下的响应应该在 data.google.systemIntent
下。对于 V2,那将是 payload.google.systemIntent
.
inputPrompt
对象也进行了一些重组,因此您应该发送包含 simpleResponse
对象的 richResponse
。
更新 我已经测试过了。这是应该返回的 entire JSON。请注意 payload
的内容与 data
的内容完全相同。 source
字段被忽略,显然与有效载荷无关。
另请参阅 https://github.com/dialogflow/fulfillment-webhook-json,其中包含一些示例。
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "This is a carousel"
}
}
]
},
"systemIntent": {
"intent": "actions.intent.OPTION",
"data": {
"@type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
"carouselSelect": {
"items": [
{
"optionInfo": {
"key": "key1",
"synonyms": [
"Option 1"
]
},
"title": "Option 1",
"description": "Option 2"
},
{
"optionInfo": {
"key": "key2",
"synonyms": [
"Option 2"
]
},
"title": "Option 2",
"description": "Option 2"
}
]
}
}
}
}
}
}
模拟器表面设置
确保您的模拟器设置为 "Phone" 表面而不是 "Speaker" 表面。选项不会显示在扬声器上。
设置应如下所示:
不是这样的:
我想弄清楚如何在 DialogFlow 的 webhook 响应中嵌入 Google 操作响应,例如 carousel。
我使用的是 REST 协议的 V2,所以我在 source
字段中填写 ACTIONS_ON_GOOGLE
并且 payload
字段包含指定的 Google Actions 字段(根据
{
"fulfillmentText":"This is a carousel.",
"source":"ACTIONS_ON_GOOGLE",
"payload":{
"conversationToken":"",
"expectUserResponse":true,
"expectedInputs":[
{
"inputPrompt":{
"initialPrompts":[
{
"textToSpeech":"This is a carousel."
}
],
"noInputPrompts":[
]
},
"possibleIntents":[
{
"intent":"actions.intent.OPTION",
"inputValueData":{,
"@type":"type.googleapis.com/google.actions.v2.OptionValueSpec"
"carouselSelect":{
"items":[
{
"optionInfo":{
"key":"key1",
"synonyms":[
"Option 1"
]
},
"title":"Option 1",
"description":"Option 2"
},
{
"optionInfo":{
"key":"key2",
"synonyms":[
"Option 2"
]
},
"title":"Option 2",
"description":"Option 2"
}
]
}
}
}
]
}
]
}
}
在控制台中尝试此操作时,没有显示轮播。仅显示文本 This is a carousel.
。供您参考,我没有包括 image
字段,因为根据规范它是可选的,但即使有图像也没有显示轮播。
这很难调试,因为我的 actions.intent.OPTION
意图没有显示在响应选项卡的 possibleIntents[]
数组中。我希望这个 actions.intent.OPTION
意图与 Dialogflow 响应生成的其他意图(例如 assistant.intent.action.TEXT
)合并。
我在这里做错了什么?我是否可能使用 V2 而不是 Dialogflow REST 协议的 V1 搬起石头砸自己的脚?
根据 Prisoner 的初步反馈更新
我尝试了以下响应,但仍然没有得到任何轮播:
{
"fulfillmentText":"Here you go.",
"source":"ACTIONS_ON_GOOGLE",
"payload":{
"expectUserResponse":true,
"richResponse":{
"items":[
{
"simpleResponse":{
"textToSpeech":"Here are your results."
}
}
]
},
"systemIntent":{
"intent":"actions.intent.OPTION",
"data":{
"carouselSelect":{
"items":[
{
"optionInfo":{
"key":"Option1",
"synonyms":[
"Option2"
]
},
"title":"Option3",
"description":"Option4"
},
{
"optionInfo":{
"key":"Option5",
"synonyms":[
"Option6"
]
},
"title":"Option7",
"description":"Option8"
}
]
},
"@type":"type.googleapis.com/google.actions.v2.OptionValueSpec"
}
}
}
}
我还尝试在 Dialogflow 中使用 returns 一个 'hardcoded' 轮播(即没有实现回调)手动创建一个意图,并且这个轮播完美显示。所以我确定控制台配置正确。
我也在将我的回复与 Google Assistant flow with multiple actions_intent_OPTION handlers 中的回复进行比较,但到目前为止没有成功。
你并没有搬起石头砸自己的脚 - 但你却让本来就有点复杂的事情变得更加复杂。有两点需要注意:
更正:确保
payload
与以前的data
相同,但其他字段已更改格式.您需要确保模拟器处于 Phone 模式而不是扬声器模式。
详情如下。
记录的 Dialogflow 差异
Dialogflow 响应的 Actions on Google documentation 有点令人困惑。它没有提供完整的示例,只是说 expectedInputs.possibleIntents
下的响应应该在 data.google.systemIntent
下。对于 V2,那将是 payload.google.systemIntent
.
inputPrompt
对象也进行了一些重组,因此您应该发送包含 simpleResponse
对象的 richResponse
。
更新 我已经测试过了。这是应该返回的 entire JSON。请注意 payload
的内容与 data
的内容完全相同。 source
字段被忽略,显然与有效载荷无关。
另请参阅 https://github.com/dialogflow/fulfillment-webhook-json,其中包含一些示例。
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "This is a carousel"
}
}
]
},
"systemIntent": {
"intent": "actions.intent.OPTION",
"data": {
"@type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
"carouselSelect": {
"items": [
{
"optionInfo": {
"key": "key1",
"synonyms": [
"Option 1"
]
},
"title": "Option 1",
"description": "Option 2"
},
{
"optionInfo": {
"key": "key2",
"synonyms": [
"Option 2"
]
},
"title": "Option 2",
"description": "Option 2"
}
]
}
}
}
}
}
}
模拟器表面设置
确保您的模拟器设置为 "Phone" 表面而不是 "Speaker" 表面。选项不会显示在扬声器上。
设置应如下所示:
不是这样的: