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

Thumbs up & down in template (v0.21.5) and Disable Microphone #769

Closed
john3216 opened this issue Dec 19, 2024 · 8 comments
Closed

Thumbs up & down in template (v0.21.5) and Disable Microphone #769

john3216 opened this issue Dec 19, 2024 · 8 comments

Comments

@john3216
Copy link

Hello Team,

I am using CloudFormation template (v0.21.5) and Lex console integrated with AWS Bedrock knowledge base to create chatbot.

I see that WebAppConfNegativeFeedback and WebAppConfPositiveFeedback have thumbs up and down values, but they do not appear on the chatbot UI, however I also have an old CloudFormation stack with template (v0.19.9) deployed last year and thumbs up and down are working in that template.

Is there a way to fix the issue in template v0.21.5? Or there is no problem with using old templates?

And also is there a way to disable/remove microphone on chatbot UI? I've tried to delete a line related to microphone from lex-web-ui-loader.js in S3 bucket, but that didn't seem work.

@bobpskier
Copy link
Contributor

@john3216 I use WebAppconfNegativeFeedback and WebAppConfPositiveFeedback in 0.21.5 and now 0.21.6 successfully. Buttons for both Thumps Up and Thumbs Down are successfully displayed.

You'll want to check the values in the resulting json config file after the template deploys. This file is requested by the lex-web-ui as it initializes. Look in the browser debugger network tab for the request for https://nnnnnnnnnn.cloudfront.net/lex-web-ui-loader-config.json. If the cloudformation template deployed successfully you will see values in the ui section for

"positiveFeedbackIntent": "Thumbs up",
"negativeFeedbackIntent": "Thumbs down",

Did you originally deploy the template with the WebAppconfNegativeFeedback and WebAppConfPositiveFeedback unset and then update / redeploy the template with values for these parameters? If yes, then it is possible the cloudfront cache still has the old configuration file cached. You can invalidate the cloudfront cache via the AWS console/CLI if that is the case.

If the cloudformation stack parameters tab shows the correct values but the json config file generated by the stack is incorrect, then something is not working correctly when the template is being deployed and/or updated.

If you can share the cloudfront url I can take a quick look at the config file and confirm the current config.

Bob

@john3216
Copy link
Author

@bobpskier I just clicked the lunch stack button on https://github.com/aws-samples/aws-lex-web-ui to deploy the stack, and I think by default, WebAppconfNegativeFeedback and WebAppConfPositiveFeedback are set with thumbs up and down already.

here's the cloudfront url for the one that I currently have: d3s9cogfj4do4x.cloudfront.net

Thank you.

@bobpskier
Copy link
Contributor

@john3216 The deployment and config looks good. Thumbs Up / Down will be displayed on the last message when the sessionState dialogAction is of type Close and the intent state is Fulfilled. The buttons will not be displayed if the bot is still trying to perform an ElicitIntent from the user. The response from the user is only prompted when intent fulfillment is complete. I'm guessing you have a Lambda servicing this bot and that its returing ElicitIntent. If the dialogAction is always ElicitIntent then feedback via the default icons will not be offered.

One way to change this behavior is to programmatically add a message at the appropriate time to the lambda response asking for positive or negative feedback with response card and Yes/No buttons. The message could be something like "Did this answer your question?" with two buttons in a response card. Yes button would send in the value "Thumbs up" and No button would send in the value "Thumbs down". The bot could then handle these just as if ThumbsUp/ThumbsDown icons were selected.

@bobpskier
Copy link
Contributor

bobpskier commented Dec 19, 2024

@john3216 Also from you original post, you can prevent display of the microphone button by setting the following in the resulting lex-web-ui-config.json in your S3 webapp bucket. I don't know of anyway to set this via the template so it needs to be a manual adjustment. I believe you could also set this via the loader config on the webpage that is loading the lex-web-ui.

"recorder": {
"enable": false
},

@john3216
Copy link
Author

@bobpskier Thank you for looking into the URL and great to hear that the deployment and config are good. The intent is a built-in GenAI intent and the fulfillment tab was set to active always. I made a change to end conversation after the intent was fulfilled, so I now see thumbs up and down buttons at the end. Thank you for your explanation.

And also I was able to disable the microphone after modifying the lex-web-ui-config.json file with your suggestion.

Thank you very much!!

@john3216
Copy link
Author

@bobpskier Hello again, regarding the thumbs up and down feature, is there a way to access the feedback data only using Lex-web-ui stack? QnAbot stack in CloudFormation can access content designer or Kibana to see its statistics like utterances, thumbs up down counts, and other data. Does Lex-web-ui need to be connected to empty qna bot or to other AWS services to see the stats for the questions and answers?

@bobpskier
Copy link
Contributor

@john3216 The positive and negative configuration in lex-web-ui only instructs lex-web-ui to display the buttons at the appropriate time and send the defined input values back via a post text mechanism to the bot. No other support for the thumbs up/down is provided in lex-web-ui. Your bot would need to implement intents that handle the positive and negative feedback. Usually the bot will maintain session state that allows it store the feedback related to the question asked and the response given. The two intents would normally be backed by a lambda function that uses the session state and the feedback to store the results in something like a dynamodb table or log to cloudwatch. From there, a quicksight dashboard or some other reporting mechanism would be used.

The qnabot solution can be configured to handle the positive and negative feedback via provided sample questions and related lambda processing. Qnabot stores the feedback in a separate opensearch index and provides results in the kibana dashboard or alternative via an s3 bucket where the results are streamed. So yes, it could be used to provide this implementation. It also has integration with bedrock / LLMs to answer questions.

I'm not that familiar with the lex service GenAI intent. I don't know if it has any build in reporting support. I would think your bot could add specific intents for thumbs up / down and wire in a fulfillment lambda to handle these. I would think the fulfillment lambda could also setup session state with the results from the GenAI intent such that feedback responses would have the necessary info to store relevant feedback. I could investigate these for your specific use case but I'd need to setup a project/contract with you.

@john3216
Copy link
Author

@bobpskier Thank you for your answer, with your advise, I implemented two intents for positive and negative feedbacks and they seemed working as intended, And I found Analytics tab from Lex console which can be associated with CloudWatch. I will try to see if using these can grab the data and stored into log group.

Thank you.

@atjohns atjohns closed this as completed Jan 13, 2025
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