aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

Interactions not working for angular component #3111

Closed vivekFAGH closed 5 years ago

vivekFAGH commented 5 years ago

Describe the bug I am trying to use the angular component for interactions. I am able to use the auth and s3 component okay. The interactions component does not display lex bot responses for any intents backed by a lambda. Any other input responds with a standard reply and the component renders the question and response. Note that the the same bot works as expected in a custom chat display component.

"@angular/core": "~7.2.0",
"aws-amplify": "^1.1.26",
"aws-amplify-angular": "^3.0.1",

I have configured amplify manually: }, Interactions: { bots: { botname1: { name: 'botname1', alias: '$LATEST', region: 'us-east-1', }, botname2: { name: 'botname2', alias: '$LATEST', region: 'us-east-1', }, } }

The angular component has this: <amplify-interactions bot="botname1" clearComplete="true" welcomeMessage='Welcome to ' (complete)="onBotComplete($event)" [conversationModeOn]="true" [voiceEnabled]="false" [textEnabled]="true">

onBotComplete(event) { console.log("On Bot Complete was called"); }

This is as far as the documentation talks about configuring and using the component. I might be missing something obvious here.

Expected behavior The component should display user input and responses for all user inputs

Screenshots image image image

haverchuck commented 5 years ago

@vivekFAGH - I noticed that you have an empty string as the value for bot in your markup. Is this just for posting to this issue, or is that what you're doing in your actual app?

vivekFAGH commented 5 years ago

Looks like its stripping off the placeholder: Interactions: { bots: { botname1: { name: 'botname1', alias: '$LATEST', region: 'us-east-1', }, botname2: { name: 'botname2', alias: '$LATEST', region: 'us-east-1', }, } } });

I have the the right bot name in the angular template file as well. I was trying to replace the bot names with placeholders before posting here

haverchuck commented 5 years ago

@vivekFAGH Do you see anything in the lambda logs indicating that the lambda is succeeding or failing in these cases?

vivekFAGH commented 5 years ago

I see success in the logs. I can test the bot from the lex console with success. I can also test the same bot in a custom angular chat component that I wrote. I was trying to switch to the amplify provided component when I noticed this issue.

vivekFAGH commented 5 years ago

Yes, same issue even after removing the complete attribute.

haverchuck commented 5 years ago

Ok, we will be looking into it.

elorzafe commented 5 years ago

@vivekFAGH can you try setting conversationModeOn=false I think that is the issue

vivekFAGH commented 5 years ago

Sorry that did not work either. I also tried keeping only the textInput tag. That did not work either. <amplify-interactions bot='botname1' clearComplete='true' welcomeMessage='Welcome to' [conversationModeOn]='false' [voiceEnabled]='false' [textEnabled]='true'>

Also, I dont see this working as well. The enter key works, a click does not. image

vivekFAGH commented 5 years ago

@elorzafe Anything else I can try?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

vivekFAGH commented 5 years ago

So I found that: when the lex response is {"dialogState":"ElicitIntent", ...}

the component displays the response.

when the lex response is "dialogState":"Fulfilled","intentName"....}

The component resets.

This is with the component configured with clearComplete='false'

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.