Code Monkey home page Code Monkey logo

Comments (7)

jankoenig avatar jankoenig commented on May 20, 2024

Hi @terloon, thanks!

Is writing toIntentWithInputs (+ toStateIntentWithInputs, toStatelessIntentWithInputs) really that much of a timesaver compared to just adding the input as a parameter? Or are you dealing with a large amount of different inputs? Can you further elaborate why you're using _.values(app.getInputs())instead of justapp.getInputs()`?

I would do it like this:

const handlers = {
    'FirstIntent': function(name, age) {
        app.toIntent('SecondIntent', name, age);
    },
    'SecondIntent': function(name, age) {
        app.tell('Hi, your name is ' + name + ', and you are ' + age + ' years old.');
    },
}

Am I missing something?

from jovo-framework.

terloon avatar terloon commented on May 20, 2024

So my use case was:

const handlers = {
    'NEW_SESSION': function() {
        // do some prep code required by all intents...
        app.toIntent(app.getIntentName(), _values(app.getInputs());
    },
    'FirstIntent': function(one, two) {
        
    },
    'SecondIntent': function(one) {
        
    }
}

But you're right, it doesn't really save much since this is done once and in NEW_SESSION would probably where this would likely be used.

Also, new to node.js (or at least its been a while since I did javascript), but I thought doing this:

app.toIntent(app.getIntentName(), app.getInputs());

would just make the first argument (or arguments[1]) be an object like:

{
    "one": "value",
    "two": "anotherValue"
}

Closing this issue. Thanks for the feedback.

from jovo-framework.

jankoenig avatar jankoenig commented on May 20, 2024

Hi @terloon, ah I get it, you want to use it inside NEW_SESSION, this is why the number of inputs is variable.

So, you have tried just using app.toIntent(app.getIntentName()) without passing a parameter, and then accessing it, like so?

const handlers = {
    'NEW_SESSION': function() {
        // do some prep code required by all intents...
        app.toIntent(app.getIntentName());
    },
    'FirstIntent': function(one, two) {
        
    },
    'SecondIntent': function(one) {
        
    }
}

Because actually this should work (cc @aswetlow). We'll look into it

from jovo-framework.

terloon avatar terloon commented on May 20, 2024

I think I narrowed down the case where I had to do this. On the Alexa Test Simulator, if I don't pass in the input, when I perform an invocation of the voice app with a command, the input is lost.

So if my invocation is "hello world" with a skill like "start thing with number 1", if I say:

"ask hello world start thing with number 1", it would lose the slot input parameter.

from jovo-framework.

jankoenig avatar jankoenig commented on May 20, 2024

Hey yes, this is due to the 'NEW_SESSION' handler.
@aswetlow and I have recently run into the same problem and will think about a way to fix this in the upcoming version

from jovo-framework.

terloon avatar terloon commented on May 20, 2024

Gotcha. Right now I am getting around it by doing what I initially mentioned:

app.toIntent(app.getIntentName(), _.values(inputs));

from jovo-framework.

jankoenig avatar jankoenig commented on May 20, 2024

This got resolved some time ago

from jovo-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.