alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

setting default values for slots ends in loop #433

Closed DunjaTomas closed 6 years ago

DunjaTomas commented 6 years ago

i'm working on a alexa skill and have some problems with the setting of default values for slots during an dialog model.

I have an intent with 4 slots and i want to give 2 of them at default values at the bedinning. This is my code to try this:

i created an intent object and set the values.

 updatedIntent = {
        "name": "Training",
        "confirmationStatus": "NONE",
        "slots": {
            "slot1": {
                "name": "slot1",
                "value": "",  /// HERE I ADDED "" BECAUSE THIS VALUE SHOULD BE FILLED BY THE USER
                "resolutions": {
                    "resolutionsPerAuthority": [
                        {
                            "authority": "",
                            "status": {
                                "code": "ER_SUCCESS_MATCH"
                            },
                            "values": [
                                {
                                    "value": {
                                        "name": "Pferde",
                                        "id": "e036baff329d97ae8387f195b27fe9af"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "confirmationStatus": "NONE"
            },
            "slot2": {
                "name": "slot2",
                "value": "test", //HERE FOR SLOT2 I ADDED MY DEFAULT VALUE "TEST"
                "resolutions": {
                    "resolutionsPerAuthority": [
                        {
                            "authority": "",
                            "status": {
                                "code": "ER_SUCCESS_MATCH"
                            },
                            "values": [
                                {
                                    "value": {
                                        "name": "Fische",
                                        "id": "4adf750f60e18ab47f596aeb5b838733"
                                    }
                                }
                            ]
                        }
                    ]
                },

after that i returned the updatedIntent via :delegate.`

  this.emit( this.emit(':delegate', updatedIntent));

Soo now slo2 is filled an Alexa does not ask me for that. But slot1 is not filled (only with "") so alexa asks me "Give me the value of slot1?" and i give the answer "test". The Input Intent is now filled with slot1=test. But it does not overwrites the "" in the output Intent. So Alexa asks me again "Give me the value of slot1?". And no matter what i say it does not fill the slot1. It ends in a loop.

What do i wrong? Maybe the syntax is wrong? or do i have to asign the input intent opject to updatedIntent?

Thank you for your help.

tianrenz commented 6 years ago

Hi @DunjaTomas ,

Do you mind posting the complete code snippet of the handler you are using to handle that intent?

It looks like you defined the updatedIntent inline so it will remain the same regardless of the incoming intent request. That will results in the code overwriting the slot1 value with "" each time.

Regards

tianrenz commented 6 years ago

Also, this seems to be a issue that's not related to the SDK.

In order to lower the maintenance cost of GitHub repo, we would suggest to follow the issue template when you open a new issue and make sure the issue is related to the SDK as bugs, feature request, documentation issues, etc.

For general questions regarding alexa skills, we recommend posting under Alexa Developer Forum.

Regards

tianrenz commented 6 years ago

Closing issue due to inactivity. Please feel free to reopen if needed.