aws-samples / aws-lex-web-ui

Sample Amazon Lex chat bot web interface
Other
745 stars 471 forks source link

Voice to Text functionality #364

Closed karanakatle closed 2 years ago

karanakatle commented 2 years ago

Hi team, I am trying to use voice to text functionality for a chatbot deployed using AWS LEX WEB UI. It is a Lex V1 chatbot. For a response card in chatbot if we type the card values, it works fine, but if we try saying card value using the microphone option it gives an error with utterance 'Sorry, I had an error handling this conversation.'. I checked previous response regarding this issue but didn't understood properly. The snapshot of error which i am getting in network debugger tab is attached here.

Can you please help me in resolving this issue.

Screenshot (3)_LI

bobpskier commented 2 years ago

Looks like a status code 400 response is being returned to the post content method. Is it possible to look at the Response tab and see what error message is present? My guess is some error with respect to the lex bot handling this post content. From the image it looks like the user would say "yes" or "no" and the bot is having issues interpreting as either yes or no. If there is a lambda backing the bot, check the function for errors during processing as well.

karanakatle commented 2 years ago

Hi @bobpskier I looked into it and found a bug. The output voice was selected to None in lex console.

Hi have a problem here.

With SSML content type, I cannot embed hyper link in a variable, which we could do with custompayload.

Is there any solution for this. I checked the alexa skill tags but cant find solution for this.

As a workaround, we thought to use hyperlink in responseCard, but on clicking, it is not opening a page, just throwing a link as a text.

Can we have any solution in this?

bobpskier commented 2 years ago

Response cards are a limited means of conveying either an image to present or provide input options to the user for their next interaction. As you noted, placing URLs in response card buttons will only configure the LexWebUi to send those URLs as a postText if clicked. Also, Lex does not compile an audio response using content from a responseCard. Since audio is not provided in the response to LexWebui from Lex, its not possible to play a response card as audio.

In terms of a hyperlink, the best to way to present this to user is via markdown in the appContext session attribute which will be presented as a link in the message in LexWebUi. See https://github.com/aws-samples/aws-lex-web-ui/blob/master/lex-web-ui/README.md#markdown-and-html-support.

karanakatle commented 2 years ago

@bobpskier I tried with it:

The Voice output is there but no text is shown in that case on lex web ui:

   altMessages = {
                      "markdown": {
                        "ssml": "<speak>"+message+"</speak>"
                      }
                    }

    response = {'sessionAttributes': session_attributes,
                'dialogAction': {
                'type': 'ElicitSlot',
                'intentName': intent_name,
                'slots': slots,
                'slotToElicit': slot_to_elicit,
                'message': 
                                {
                                    'contentType': type,
                                    'content': '<speak>'+message+'</speak>'
                                }
                            }   
                        }
    response['sessionAttributes']['appContext'] =json.dumps({'responseCard': x})
    response['sessionAttributes']['appContext'] =json.dumps({'altMessages': altMessages})

I added the code for response card and altmessages together in my elicit slot function. But when i interact with bot via voice, In session attributes i can see the required message which needs to be prompted (the message is configured in lambda). But placeholder under the slot in lex console gets prompted.

For example. In lex console for an slot: Place holder in prompt section is 'What city' and priority of that is also not checked.

Message for the same slot I configured in Lambda.

When I interact with lambda via voice, instead of that lambda configured message, lex reads console slot placeholder.