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

Displaying more than 3 buttons in response #53

Open
y0x opened this issue Feb 10, 2020 · 4 comments
Open

Displaying more than 3 buttons in response #53

y0x opened this issue Feb 10, 2020 · 4 comments

Comments

@y0x
Copy link

y0x commented Feb 10, 2020

Hi everyone,

i´m currently trying to display more than just three button elements in the chat window, but for some reason it does not work. Does anyone know where the settings for this case are?

Here an example:

 replies: [
        {
          type: "buttons",
          content: {
            title: `You are searching for ${oMemory.product.raw} for the following regions. `,
            buttons: [
              {
                value: "test1",
                title: "test2",
                type: "postback"
              },
              {
                value: "test1",
                title: "test2",
                type: "postback"
              },
              {
                value: "test1",
                title: "test2",
                type: "postback"
              },
              {
                value: "test1",
                title: "test2",
                type: "postback"
              },
              {
                value: "test1",
                title: "test2",
                type: "postback"
              }
            ]
          }
        }
      ],
      conversation: {
        memory: oMemory
      }

chatbot_display

The Code above results in the image I´ve attached.

Thanks.

@JWandrocke
Copy link
Contributor

JWandrocke commented Feb 10, 2020

It is currently hard code to only display 3 buttons in the WebChat.

Here is the code in the Button.js

    {buttons.slice(0, 3).map((b, i) => (
      <Button key={i} button={b} sendMessage={sendMessage} />
    ))}

@y0x
Copy link
Author

y0x commented Feb 14, 2020

Isn´t there any other configuration item that could cause this. As you can see in my example that I don´t have only three hardcoded buttons.
My application is hosted on (https://cai.tools.sap/) and the backend is entirely self written using nodejs/ express. So the configuration to only display 3 buttons should be anywhere else. But It´s not in my code. Could it be that the hosting platform cai.tools.sap is limiting this by default, but I can´t find anything in the documention..

Thanks for your help!

@ya332
Copy link

ya332 commented Feb 14, 2020

It has been already answered JWandrocke by chipping in. The button count is hardcoded, you could download the source code, change the number to however you want, build it again and that way you can have as many buttons as you want. However, if you want to deploy it and use it for production, you have to self-host it rather than doing <script>https://cai ... </script> etc. Other option is to create a pull request in order to pass the number of buttons as props from the main component to Button.js component. Hope this helps.

@timoniac
Copy link

timoniac commented Feb 24, 2020

what i dont understand: why is it possible to create more than 3 buttons in menu when only 3 show up? Also the right-alignment of the text in a list-answer is so bad ... why cant we manage those UI-Elements via the Framework instead of self-hosting it?

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

4 participants