使用轮播选项时,基本的卡片和建议筹码不会呈现

时间:2018-11-19 01:11:56

标签: actions-on-google

我目前正在完成有关Google动作的培训:

  1. https://codelabs.developers.google.com/codelabs/actions-1/index.html
  2. https://codelabs.developers.google.com/codelabs/actions-2/index.html
  3. https://codelabs.developers.google.com/codelabs/actions-3/index.html

https://codelabs.developers.google.com/codelabs/actions-3/index.html的第8步外,其他所有工作似乎都很好。我尝试了几次,并亲自寻求其他人的帮助,但是我没有运气让它起作用。

仅当我尝试从轮播选项中显示基本卡和建议筹码时,才会出现问题。当我分开键入轮播的响应时,基本卡片和建议筹码显示得很好,但是无论何时我通过文本,语音或触摸屏触发轮播,尽管看起来几乎相同,但基本卡片和建议筹码都无法工作要求。我正在通过模拟器对此进行测试。以下是我的一些结果(不包括用户):

没有轮播请求:

{
  "conversation": {
    "conversationId": "ABwppHF_1K01OSff9j2qRUTXc0QAExd_rouvB_UvqD8kQl4mWREUxzoESBnJCaaP1UX89IoyXuLkKxChFG3YAfr7drY",
    "type": "ACTIVE",
    "conversationToken": "[]"
  },
  "inputs": [
    {
      "intent": "actions.intent.TEXT",
      "rawInputs": [
        {
          "inputType": "KEYBOARD",
          "query": "pink unicorn"
        }
      ],
      "arguments": [
        {
          "name": "text",
          "rawText": "pink unicorn",
          "textValue": "pink unicorn"
        }
      ]
    }
  ],
  "surface": {
    "capabilities": [
      {
        "name": "actions.capability.SCREEN_OUTPUT"
      },
      {
        "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
      },
      {
        "name": "actions.capability.WEB_BROWSER"
      },
      {
        "name": "actions.capability.AUDIO_OUTPUT"
      }
    ]
  },
  "isInSandbox": true,
  "requestType": "SIMULATOR"
}

没有轮播响应:

{
  "conversationToken": "[\"favoritefakecolor-followup\"]",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "Here you go."
              }
            },
            {
              "basicCard": {
                "title": "Pink Unicorn",
                "formattedText": "Pink Unicorn is an imaginative reddish hue.",
                "image": {
                  "url": "https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDbFVfTXpoaEE5Vzg/style-color-uiapplication-palette2.png",
                  "accessibilityText": "Pink Unicorn Color"
                },
                "imageDisplayOptions": "WHITE"
              }
            },
            {
              "simpleResponse": {
                "textToSpeech": "Do you want to hear about another fake color?"
              }
            }
          ],
          "suggestions": [
            {
              "title": "Yes"
            },
            {
              "title": "No"
            }
          ]
        }
      },
      "possibleIntents": [
        {
          "intent": "assistant.intent.action.TEXT"
        },
        {
          "intent": "7834d6b7-c6f6-4baf-9e61-20b9b0f4f472"
        },
        {
          "intent": "1f5dbadc-605b-4b3f-baa3-734ac590aefd"
        }
      ],
      "speechBiasingHints": [
        "$fakeColor"
      ]
    }
  ],
  "responseMetadata": {
    "status": {
      "message": "Success (200)"
    },
    "queryMatchInfo": {
      "queryMatched": true,
      "intent": "46251bfd-4c19-449d-979c-c1a88a8c4386",
      "parameterNames": [
        "fakeColor"
      ]
    }
  }
}

有轮播请求:

{
  "conversation": {
    "conversationId": "ABwppHF_1K01OSff9j2qRUTXc0QAExd_rouvB_UvqD8kQl4mWREUxzoESBnJCaaP1UX89IoyXuLkKxChFG3YAfr7drY",
    "type": "ACTIVE",
    "conversationToken": "[\"favoritefakecolor-followup\"]"
  },
  "inputs": [
    {
      "intent": "actions.intent.OPTION",
      "rawInputs": [
        {
          "inputType": "TOUCH",
          "query": "Pink Unicorn"
        }
      ],
      "arguments": [
        {
          "name": "OPTION",
          "textValue": "pink unicorn"
        },
        {
          "name": "text",
          "rawText": "Pink Unicorn",
          "textValue": "Pink Unicorn"
        }
      ]
    }
  ],
  "surface": {
    "capabilities": [
      {
        "name": "actions.capability.SCREEN_OUTPUT"
      },
      {
        "name": "actions.capability.AUDIO_OUTPUT"
      },
      {
        "name": "actions.capability.WEB_BROWSER"
      },
      {
        "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
      }
    ]
  },
  "isInSandbox": true,
  "requestType": "SIMULATOR"
}

轮播响应:

{
  "conversationToken": "[\"favoritefakecolor-followup\"]",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "Here you go."
              }
            },
            {
              "basicCard": {
                "title": "Pink Unicorn",
                "formattedText": "Pink Unicorn is an imaginative reddish hue.",
                "image": {
                  "url": "https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDbFVfTXpoaEE5Vzg/style-color-uiapplication-palette2.png",
                  "accessibilityText": "Pink Unicorn Color"
                },
                "imageDisplayOptions": "WHITE"
              }
            },
            {
              "simpleResponse": {
                "textToSpeech": "Do you want to hear about another fake color?"
              }
            }
          ],
          "suggestions": [
            {
              "title": "Yes"
            },
            {
              "title": "No"
            }
          ]
        }
      },
      "possibleIntents": [
        {
          "intent": "assistant.intent.action.TEXT"
        },
        {
          "intent": "7834d6b7-c6f6-4baf-9e61-20b9b0f4f472"
        },
        {
          "intent": "1f5dbadc-605b-4b3f-baa3-734ac590aefd"
        }
      ],
      "speechBiasingHints": [
        "$fakeColor"
      ]
    }
  ],
  "responseMetadata": {
    "status": {
      "message": "Success (200)"
    },
    "queryMatchInfo": {
      "queryMatched": true,
      "intent": "46251bfd-4c19-449d-979c-c1a88a8c4386"
    }
  }
}

我注意到的一个关键差异是尽管它们在响应中都包含基本卡和建议芯片,但只有没有轮播的流程才在调试器中包含可视元素。

带轮播:

"visualResponse": {
    "visualElementsList": [
      {
        "displayText": {
          "content": "Here you go."
        }
      },
      {
        "displayText": {
          "content": "Do you want to hear about another fake color?"
        }
      }
    ]

没有旋转木马:

"visualElementsList": [
      {
        "basicCard": {
          "title": "Pink Unicorn",
          "subtitle": "",
          "formattedText": "Pink Unicorn is an imaginative reddish hue.",
          "image": {
            "url": "https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDbFVfTXpoaEE5Vzg/style-color-uiapplication-palette2.png",
            "accessibilityText": "Pink Unicorn Color",
            "height": 0,
            "width": 0
          },
          "buttonsList": [],
          "imageDisplayOptions": 1
        }
      },
      {
        "displayText": {
          "content": "Here you go."
        }
      },
      {
        "displayText": {
          "content": "Do you want to hear about another fake color?"
        }
      }
    ],
    "suggestionsList": [
      {
        "title": "Yes"
      },
      {
        "title": "No"
      }
    ]

0 个答案:

没有答案