Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

actions on google - Why is the carousel not showing in the console simulator?

I am trying to figure out how I can embed Google Actions responses, such as the carousel, in a webhook response for DialogFlow.

I am using V2 of the REST protocol, so I am filling ACTIONS_ON_GOOGLE in the source field and the payload field contains the Google Actions field as specified (as per How can I integrate the Google Actions responses in a webhook response in Dialogflow?). I am sending the following response:

{
   "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"
                           }
                        ]
                     }
                  }
               }
            ]
         }
      ]
   }
}

When trying this out in the console, no carousel is shown. Only the text This is a carousel. is displayed. For your information, I did not include the image field, as it is optional according to the specification, but even with images there is no carousel displayed.

It's hard to debug this, as my actions.intent.OPTION intent is not displayed in possibleIntents[] array in the response tab. I expected this actions.intent.OPTION intent to be merged with the other intents (such assistant.intent.action.TEXT) as generated by the Dialogflow response.

What am I doing wrong here? Am I maybe shooting myself in the foot by using V2 instead of V1 of the Dialogflow REST protocol?

update after initial feedback by Prisoner

I tried with the following response, but still not getting any carousel:

{
   "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"
         }
      }
   }
}

I also tried to manually create an intent in Dialogflow with returns a 'hardcoded' carousel (that is, without fulfillment callback) and this carousel is shown perfectly. So I am sure that the console is correctly configured.

I am also comparing my response with the ones in Google Assistant flow with multiple actions_intent_OPTION handlers, but without success so far.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...