botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
78 stars 87 forks source link

[BUG] Wrong value is sent to the bot when single choice is used #1608

Closed Jeremynano closed 2 years ago

Jeremynano commented 2 years ago

Describe the bug

Is seem that the wrong value is sent to the bot when single choice is used.

If i put "Je veux adhérer" in "message", and "Préparer ma retraite" in "value", my intent "Je veux preparer ma retraite" is triggered, perfect.

image image image

But if i change my message to "✔️✔️Je veux adhérer 💵🤗" it seem that my bot can't recognize my intent, even if the value of of choice stay the same.

image image image

Expected behavior

Intent recognition should be stable if the value sent stay the same, even if the message displayed to the user is different

Environment (please complete the following information):

allardy commented 2 years ago

In a choice skill, the value you put in the "value" field is a special payload that is sent back to the bot when the button is clicked. That payload isn't linked to any intent or QNA.

When you select a choice option, the "Message" is written as the "preview" of your message, while the "Value" is accessible via event.payload.payload .

This is why your first situation works, while the second doesn't. I kind of like that approach tho. Out of my mind, i'd suggest adding a hook which would handle events of type "quick_reply" and change event.preview to the value of event.payload.payload, maybe an after_incoming_middleware? or before. Not entirely sure where it should sit