Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make several outputs in onIntent #1181

Open
Reg93 opened this issue Sep 13, 2022 · 7 comments
Open

How to make several outputs in onIntent #1181

Reg93 opened this issue Sep 13, 2022 · 7 comments

Comments

@Reg93
Copy link

Reg93 commented Sep 13, 2022

Hello, i can't find way how to make 'output.answer' do this:

P: hello
Bot: Good
Bot: Morning!

Is there possibility to realise it and how?

nlp.onIntent = async (nlp, input) => {
try {
if (input.intent === 'greetings.hello') {

    const hours = new Date().getHours();
    const output = input;

    if (hours < 12) {
        output.answer = 'Good morning, Regina!'
    } else if (hours < 17) {
      output.answer = 'Good afternoon, Regina!'
    } else {
      output.answer = 'Good evening!, Regina';
    }
    return output;
}
@Apollon77
Copy link
Contributor

this sounds like a very custom requirements. In fact you could design the answers in a way that you can split them ... like use a newline character and adjust the answer logic that answer is splitted on newline

@Reg93
Copy link
Author

Reg93 commented Sep 26, 2022

this sounds like a very custom requirements. In fact you could design the answers in a way that you can split them ... like use a newline character and adjust the answer logic that answer is splitted on newline

Thank you, but it didn't help. It works in directline connector, but not in onIntent

@Apollon77
Copy link
Contributor

The code you added to the initial post is just changing the answer given back. I understood you want to have "two answers".

The whole system right now is design to return "one string as answer" ... so the only way you have is to use the respone and then "split" it and return two answers when doing the output.

@aigloss
Copy link
Collaborator

aigloss commented Nov 25, 2022

Hi @Reg93 ,

you could use a custom action to implement that behaviour and/or use bot orchrestation (see #715)

@Reg93
Copy link
Author

Reg93 commented Dec 1, 2022

The code you added to the initial post is just changing the answer given back. I understood you want to have "two answers".

The whole system right now is design to return "one string as answer" ... so the only way you have is to use the respone and then "split" it and return two answers when doing the output.

Hello, yes, i tried it, but it didn't work unfortunately

@Reg93
Copy link
Author

Reg93 commented Dec 1, 2022

Hi @Reg93 ,

you could use a custom action to implement that behaviour and/or use bot orchrestation (see #715)

Thank you! i will check it

@Apollon77
Copy link
Contributor

Apollon77 commented Dec 1, 2022

Hello, yes, i tried it, but it didn't work unfortunately

If you could share code this would maybe bringt some more light into the why not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants