aws-samples / aws-lex-web-ui

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

Facing issue related number of responses diplayed by web ui #510

Closed yainoit closed 6 months ago

yainoit commented 1 year ago

From the backend I am sending three messages in response but in the first intent which is automatically getting invoked I can see only 2 messages . but when i call the first intent explicitly I can see all those three messages. I am not able to debug the web ui since i am new to it. Can you please help me to figure it out

bobpskier commented 1 year ago

@yainoit Are you using LexV2 or LexV1? On the backend I'm going to assume you are using a Lambda function to provide the response. Can you dump/capture the entire backend response just prior to returning it to the Lex service? If yes, can you provide the response being provided for both examples? It will be good to compare them to ensure they are virtually identical. Next, in the browser debugger can you capture the response payload in the network tab of the debugger for both cases? With this data we can debug what might be happening in the lex-web-ui.

yainoit commented 1 year ago

I am using LEX V2. In the network tab i can see the all the response message but however it is not appearing at ui.

if intent_name == 'welcome': print("welcome intent") message1 = plain_text(''What can I help you with today? --message1") message1 = plain_text('''What can I help you with today?message2" ) message1 = plain_text('''What can I help you with today?-message3 ) message1 = plain_text('''What can I help you with today?-message4" )

    #return elicit_slot(session_attributes, slots= None,
                    #slot_to_elicit="topic", intent_name = "TopicSelectionIntent", message=[message1])
    return close(intent_request, session_attributes,"Fulfilled", [message1,message2,message3,message4])

First time I am calling this intent implicitly without user input and that i am not able to see all 4 messages but in the n/w tab i can see all the four messages. But when I am calling this intent explicitly by typing "Hi" then I can see all the four messages.

bobpskier commented 1 year ago

@yainoit Are you having LexWebUi send in an initial utterance to start the conversation? This would result in a POST request to RecognizeText. Can you copy the request payload (json) from the network tab for this POST request to RecognizeText and the response (json) from the network tab and paste in this thread? If you are not sending in an initial utterance, no request/response will be made until the user enters and sends text. If you can share the URL to the lexwebui we can look at the behavior as well. The response payload will look similar to that defined at https://docs.aws.amazon.com/lexv2/latest/APIReference/API_runtime_RecognizeText.html.