aws-samples / aws-lex-web-ui

Sample Amazon Lex chat bot web interface
Other
734 stars 466 forks source link

Response Card not getting rendered #334

Closed rprasaath closed 2 years ago

rprasaath commented 2 years ago

I am using the default code with only changes in json to point to my aws config. The intent in the aws lex has response card and when i use this and launch the web ui, the response card does not come and instead when that slot type question comes then no response comes. Can you let me know what needs to be done to enable responsecard option ?

rprasaath commented 2 years ago

I am using the default code with only changes in json to point to my aws config. The intent in the aws lex has response card and when i use this and launch the web ui, the response card does not come and instead when that slot type question comes then no response comes. Can you let me know what needs to be done to enable responsecard option ?

I am using Lex V2 version where Response card is not working. The response card is only working with V1 version

bobpskier commented 2 years ago

Which default example are you using? What were the steps you used to deploy? From a lambda function perspective, response formats are quite different between LexV1 and LexV2. If using lambda, the code would need to be specific for Lex V2. If using the V2 console to create a LexV2 bot with response card can you point me at the example and we can take a look?

rprasaath commented 2 years ago

@bobpskier , I have used order flowers in Lex V2 and modified the slot type to response card type. I have updated the cognito configuration and v2BotId, v2BotAliasId, v2BotLocaleId in json file in https://github.com/aws-samples/aws-lex-web-ui/tree/master/src/config to point to Lex V2. In this I have not used Lambda. The response card creation was via Lex V2 UI Console.

bobpskier commented 2 years ago

If you have originally setup the LexWebUi instance using V1, please delete and redeploy a new instance specifying the V2 parameters. Also role/policies are managed via template parameters. Just modifying the json file is most likely not going to result in all the permissions you need.

In the V2 console for the OrderFlowers sample bot, I configured the following Buttons. Make sure to provide a Title. Lex Web Ui will ignore the title unless configured otherwise.

LexV2SlotConfig

Save the updated Slot, Intent, and rebuild. The create a new version and associate the version with your alias.

Lex Web UI will display the following buttons:

LexWebUiSample

rprasaath commented 2 years ago

Can you let me know the json configuration which you provided i.e. I tried to put v2BotId, v2BotLocaleId & v2BotAliasId and left botName & botAlias empty. In this configuration i got "Sorry, I was unable to process your message. Try again later.". If i fill v2BotId, v2BotLocaleId & v2BotAliasId and put botname as v2botid and botAlias as $LATEST then if it does not contain response card in configuration then it works else it does not work instead nothing gets rendered.

FYKI.. i dont have any BOT in lex v1 and in V2 i created a new version and created a new alias and linked that alias to this new version

bobpskier commented 2 years ago

When you fill in a botname you are configuring LexWebUi to run in V1 mode. It will attempt to call using V1 the supplied botname which will not exist. To use V2, the botname and bot alias in the V1 section should be left as originally set. Only modify in the V2 section the BotId, BotAliasId, and BotLocaleId with the relevant V2 information. When you see the "Sorry, I was unable to process your message", there will be a response visible in the browser debugger network tab for the recognizeText request. This response should indicate the failure being returned from the Lex V2 API request and should help identify what is failing.

rprasaath commented 2 years ago

I was able to fix that error "Sorry unable to process your message" however the response card is not getting rendered. It does not display anything. In the browser console there is no error and in the network i am able to see the response values but still that is not coming as buttons similar to how you have in your screenshot

image
bobpskier commented 2 years ago

The most recent version 0.19.3 of LexWebUi contains a fix to display the response card from a LexV2 response when no message text is provided. I believe that is the issue with the response card not being rendered. If this does not solve it, please reopen the issue if needed.

hongNianYS commented 2 years ago

am using the I have changed my title and save, but can not see the title or the subtitle in my website, the text is null , could please tee me why?