Search code examples
dialogflow-esactions-on-googlejovo-framework

Error: Input type must be defined in inputTypes jovo-framework


Follow Docs I tried to make Custom Entities (Developer Entities) as following lines:

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

And it got below error when I want to build via command line 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' } }

Actually, I don't know how to make it correctly,

Please help me,

Really thanks.

p/s :

  • I totally understand Developer Entities since I able to make Custom Entities (Developer Entities) on DialogFlow easily. Please see image as sample

enter image description here enter image description here enter image description here enter image description here

  • If not use this Developer Entities, I able to run command line : jovo build jovo deploy --project-id ... jovo run

Solution

  • Currently, I able to avoid this issue.

    I know that this json file I define incorrectly.

    So I need modify to get correct result as below codes :

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