收到的JSON有效负载无效。找不到字段。字段违规

时间:2017-07-22 00:29:25

标签: json node.js dialogflow actions-on-google

我正在尝试使用MAC上的gactions命令更新我的actions_package action.json文件。它给了我无效的JSON有效负载和字段违规错误。

我的action.json文件如下所示:

{
  "versionLabel": "<Appname> V1",
  "agentInfo": {
    "languageCode": "en-US",
    "projectId": "<project_id>",
    "voiceName": "male_1"
  },
    "actions": [
      {
        "description": "Default Welcome Intent",
        "name": "input.welcome",
        "fulfillment": {
          "conversationName": "convo1"
        },
        "intent": {
          "name": "Default Welcome Intent",
          "trigger": {
            "queryPatterns": [
              {"queryPattern": "talk to <Appname>"},
              {"queryPattern": "play <Appname>"}
            ]
          }
        }
      }  
    ],
  "conversations": {
          "convo1": {
          "name": "convo1",
          "url": "<CloundFunction url generated by firebase deploy>"
          }
        }


}

我收到“agentInfo”,“queryPattern”(两次)和“versionLabel”的错误。 我在这个action.json文件中引用了Google文档的这些链接:

https://github.com/actions-on-google/apiai-webhook-template-nodejs https://developers.google.com/actions/sdk/action-package

错误如下:

ERROR: Failed to update the app for the Assistant
ERROR: Invalid JSON payload received. Unknown name "query_pattern" at 'agent.draft_action_package.actions[0].intent.trigger.query_patterns[0]': Cannot find field.
Invalid JSON payload received. Unknown name "query_pattern" at 'agent.draft_action_package.actions[0].intent.trigger.query_patterns[1]': Cannot find field.
Invalid JSON payload received. Unknown name "agent_info" at 'agent.draft_action_package': Cannot find field.
Invalid JSON payload received. Unknown name "version_label" at 'agent.draft_action_package': Cannot find field.
Field Violations:
#  Field                                                                   Description
1  agent.draft_action_package.actions[0].intent.trigger.query_patterns[0]  Invalid JSON payload received. Unknown name "query_pattern" at 'agent.draft_action_package.actions[0].intent.trigger.query_patterns[0]': Cannot find field.
2  agent.draft_action_package.actions[0].intent.trigger.query_patterns[1]  Invalid JSON payload received. Unknown name "query_pattern" at 'agent.draft_action_package.actions[0].intent.trigger.query_patterns[1]': Cannot find field.
3  agent.draft_action_package                                              Invalid JSON payload received. Unknown name "agent_info" at 'agent.draft_action_package': Cannot find field.
4  agent.draft_action_package                                              Invalid JSON payload received. Unknown name "version_label" at 'agent.draft_action_package': Cannot find field.
2017/07/21 16:28:31 Server did not return HTTP 200

1 个答案:

答案 0 :(得分:0)

看起来您正在指定已弃用的v1 actions.json。有关如何为v2更新此信息的信息,请参阅https://developers.google.com/actions/reference/v1/migration#action_package_changes

您引用的第二个URL是过时的文档。

(我仍然不确定api.ai在这里是如何参与的。)