jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.67k stars 310 forks source link

Synonyms do not map to the correct value #560

Closed probststefan closed 4 years ago

probststefan commented 5 years ago

I'm submitting a...

Expected Behavior

Synonyms do not map to the correct value.

` { "name": "DrinkSelectionIntent", "phrases": [ "{drink}", "{drink} bitte", "ich würde gerne {drink} trinken", "wir trinken {drink}", "ich trinke {drink}" ], "inputs": [ { "name": "drink", "type": "LIST_OF_DRINKS" } ] },

...

"inputTypes": [ { "name": "LIST_OF_DRINKS", "values": [ { "value": "Champagner", "synonyms": [ "Sekt" ] }, `

Current Behavior

I expect the input "Sekt" to be mapped to "Champager" in "this.$inputs". But it returns this:

{ drink: { name: 'drink', alexaSkill: { name: 'drink', value: 'sekt' }, value: 'sekt', key: 'sekt' } }

Your Environment

aswetlow commented 5 years ago

Hey!

the value is mapped from the "said value". I get Champagner in key.

What's your jovo-platform-alexa version? jovo -v

probststefan commented 5 years ago

Im running on jovo-platform-alexa: 2.2.17

aswetlow commented 5 years ago

Hm, any idea how I could reproduce it?

I tested it with the same version.

probststefan commented 5 years ago

Could you publish the code you used to try it out?

aswetlow commented 5 years ago

Alexa Language model:

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "meine trink app",
            "intents": [
                {
                    "name": "DrinkSelectionIntent",
                    "slots": [
                        {
                            "name": "drink",
                            "type": "LIST_OF_DRINKS"
                        }
                    ],
                    "samples": [
                        "{drink}",
                        "{drink} bitte",
                        "ich würde gerne {drink} trinken",
                        "wir trinken {drink}",
                        "ich trinke {drink}"
                    ]
                },
                {
                    "name": "AMAZON.NavigateHomeIntent",
                    "samples": []
                }
            ],
            "types": [
                {
                    "name": "LIST_OF_DRINKS",
                    "values": [
                        {
                            "name": {
                                "value": "Champagner",
                                "synonyms": [
                                    "Sekt"
                                ]
                            }
                        }
                    ]
                }
            ]
        }
    }
}

app.js

'use strict';

// ------------------------------------------------------------------
// APP INITIALIZATION
// ------------------------------------------------------------------

const { App } = require('jovo-framework');
const { Alexa } = require('jovo-platform-alexa');
const { GoogleAssistant } = require('jovo-platform-googleassistant');
const { JovoDebugger } = require('jovo-plugin-debugger');
const { FileDb } = require('jovo-db-filedb');

const app = new App();

app.use(
    new Alexa(),
    new GoogleAssistant(),
    new JovoDebugger(),
    new FileDb()
);

// ------------------------------------------------------------------
// APP LOGIC
// ------------------------------------------------------------------

app.setHandler({
    LAUNCH() {
        return this.ask('Welches Getränk?');
    },
    DrinkSelectionIntent() {
        console.log(this.$inputs);

    },
});

module.exports.app = app;

"öffne meine trink app" "sekt"

console.log(this.$inputs) in DrinkSelectionIntent

{ drink:
   { name: 'drink',
     alexaSkill:
      { name: 'drink',
        value: 'sekt',
        resolutions: [Object],
        confirmationStatus: 'NONE',
        source: 'USER' },
     value: 'sekt',
     key: 'Champagner',
     id: '3df2482b6c2a8670322f9232582d2300' } }
aswetlow commented 5 years ago

Are you using the jovo debugger?

probststefan commented 5 years ago

Yes, i'm using the jovo debugger. What is the difference between "inputTypes" and "types". I have to name it "inputTypes" otherwise i get this error: Input type "LIST_OF_DRINKS" must be defined in inputTypes

aswetlow commented 5 years ago

Oh, that's the problem here. The debugger doesn't support the mapping of synonyms yet. I will put it on a higher prioritized list, but won't be able to fix it within the next two weeks.

It works fine with the Alexa Simulator. (Install our Chrome Extension for a Jovo Debugger feeling :D https://chrome.google.com/webstore/detail/alexa-skills-kit-simulato/opjjjciodammljgdambcjmljkcjblkkk)

inputTypes is used in the Jovo Language Model and it's the equivalent of types in the Alexa Language Model.

aswetlow commented 4 years ago

We updated the Jovo Debugger. You can add the key or/and id to your requests. You need to update your project to v 2.2.17 or later.