【问题标题】:Error: Input type must be defined in inputTypes jovo-framework错误:必须在 inputTypes jovo-framework 中定义输入类型
【发布时间】:2018-10-26 10:04:28
【问题描述】:

Follow Docs 我尝试将自定义实体(开发者实体)制作为以下几行:

en-US.json:

{
        "name": "TopicChooseIntent",
        "phrases": [
            "play {topic} chart",
            "{topic} music",
            "play {topic} music",
            "what's {topic} today",
            "what {topic} today"
        ],
        "inputs": [
            {
                "name": "topic",
                "type": {
                    "dialogflow": "@sys.any"
                }
            },
            {
                "name": "city",
                "type": "@dev-city"
            }
        ],
        "inputTypes": [
            {
                "name": "@dev-city",
                "dialogflow": {
                    "automatedExpansion": true
                },
                "values": [
                    {
                        "value": "Berlin"
                    },
                    {
                        "value": "New York",
                        "synonyms": [
                            "New York City"
                        ]
                    }
                ]
            }
        ]
    }

,
"dialogflow": {
    "intents": [
        {
            "name": "Default Fallback Intent",
            "auto": true,
            "webhookUsed": true,
            "fallbackIntent": true
        },
        {
            "name": "Default Welcome Intent",
            "auto": true,
            "webhookUsed": true,
            "events": [
                {
                    "name": "WELCOME"
                }
            ]
        }
    ]
}

app.js

app.setHandler({
    'TopicChooseIntent': function (topic) {
    }
})

当我想通过命令行jovo build 构建时,出现以下错误:

❯ Updating /platforms/googleAction/dialogflow
 ✔ Updating Dialogflow Agent
   ✔ agent.json
   ✔ package.json
 ❯ Updating Dialogflow Language Model based on Jovo Language Model in /models
   ✖ en-US
     -> Input type "@dev-city" must be defined in inputTypes
{ Error: Input type "@dev-city" must be defined in inputTypes
at DialogFlowAgent.transform (/usr/local/lib/node_modules/jovo-cli/helper/dialogFlowAgent.js:381:35)
at Promise (/usr/local/lib/node_modules/jovo-cli/helper/dialogflowUtil.js:230:21)
at new Promise (<anonymous>)
at Object.buildLanguageModelDialogFlow (/usr/local/lib/node_modules/jovo-cli/helper/dialogflowUtil.js:225:16)
at Task.task (/usr/local/lib/node_modules/jovo-cli/commands/tasks.js:332:38)
at Promise.resolve.then.then.skipped (/usr/local/lib/node_modules/jovo-cli/node_modules/listr/lib/task.js:168:30)
 context:
 { locales: [ 'en-US' ],
 type: [ 'googleAction' ],
 projectId: undefined,
 endpoint: 'jovo-webhook',
 target: 'all',
 src: '/Users/folder/Desktop/GoogleHome/',
 stage: '',
 askProfile: 'default' } }

其实我也不知道怎么弄好,

请帮帮我,

非常感谢。

p/s:

  • 我完全了解开发者实体,因为我能够轻松地在 DialogFlow 上制作自定义实体(开发者实体)。请查看图片作为示例

  • 如果不使用这个开发者实体,我可以运行命令行: jovo buildjovo deploy --project-id ...jovo run

【问题讨论】:

    标签: dialogflow-es actions-on-google jovo-framework


    【解决方案1】:

    我认为问题出在名称上。 Dialogflow Docs for Developer Entities 声明它们应该“以字母开头,并且可以包含以下内容:A-Z、a-z、0-9、_(下划线)、-(破折号)”。

    您是否尝试过删除 @ 并仅使用 dev-city 作为实体名称?

    【讨论】:

    • 不,我从@dev-city 更改为devcity 仍然有同样的错误:Error: Input type "devcity" must be defined in inputTypes。我需要在其他地方定义实体名称吗? p/s:我更新了问题供您查看更多信息。
    • 快速提问:您能否通过像 jsonlint.com 这样的 JSON 验证器运行您的 Jovo 模型 en-US.json 文件,看看格式是否有问题?
    • 是的,完全有效的 json。我更新了问题给你看^^ 看起来你从来没有遇到过这个问题? ^^ 你能给我这个问题的正确样本吗?并找到解决方案?
    【解决方案2】:

    目前,我能够避免这个问题。

    我知道这个json 文件我定义不正确。

    所以我需要修改以获得正确的结果,如下代码:

    en-US.json

    "name": "TopicChooseIntent",
            "phrases": [
                "play {topic} chart",
                "{topic} music",
                "play {dev-city} music",
                "choose {dev-city} music",
                "what's {topic} today",
                "what {topic} today"
            ],
    "inputs": [
            {
                "name": "topic",
                "type": {
                    "dialogflow": "@sys.any"
                }
            }
        ],
    "inputTypes": [
            {
                "name": "@dev-city",
                "dialogflow": {
                    "automatedExpansion": true
                },
                "values": [
                    {
                        "value": "Berlin"
                    },
                    {
                        "value": "New York",
                        "synonyms": [
                            "New York City"
                        ]
                    }
                ]
            }
        ]
    

    en-US.json

    "dialogflow": {
        "intents": [
            {
                "name": "Default Fallback Intent",
                "auto": true,
                "webhookUsed": true,
                "fallbackIntent": true
            },
            {
                "name": "Default Welcome Intent",
                "auto": true,
                "webhookUsed": true,
                "events": [
                    {
                        "name": "WELCOME"
                    }
                ]
            }
        ],
        "entities": [
            {
                "name": "dev-city",
                "isOverridable": false,
                "isEnum": false,
                "automatedExpansion": false
            }
        ]
    }
    

    【讨论】:

      猜你喜欢
      • 2016-10-14
      • 2019-09-19
      • 2017-09-03
      • 2018-01-30
      • 1970-01-01
      • 2019-03-15
      • 2012-01-01
      • 2023-03-24
      相关资源
      最近更新 更多