aws-lex-web-ui
aws-lex-web-ui copied to clipboard
Response card subtitle not showing up
I think this is because the API response property is subtitle
and from the Vue component you are getting the subTitle
property.
https://github.com/aws-samples/aws-lex-web-ui/blob/v0.19.4/lex-web-ui/src/components/ResponseCard.vue#L8
@tuanis-ebrenes Another Lex V2 breaking change. Lex V1 required "subTitle". https://docs.aws.amazon.com/lex/latest/dg/API_runtime_GenericAttachment.html. Lex V2 requires "subtitle" as you indicated. https://docs.aws.amazon.com/lexv2/latest/dg/API_runtime_ImageResponseCard.html.
Simplest change is in ResponseCard.vue. To support both V1 or V2 in the same code, change lines 8-10 to be
<v-card-text v-if="responseCard.subTitle">
<span>{{responseCard.subTitle}}</span>
</v-card-text>
<v-card-text v-if="responseCard.subtitle">
<span>{{responseCard.subtitle}}</span>
</v-card-text>
The other mechanism would be to change lex-web-ui/src/lib/lex/client.js such that it normalizes the response to match the V1 json. I've always disliked normalizing the V2 ImageResponseCard into a V1 GenericAttachment but rather than rewriting LexWebUi to support only V2 that was the decision made. LexWebUi does its best to allow operation with either LexV1 or LexV2. This is a case where LexWebUi didn't catch all the differences.
@tuanis-ebrenes I submitted a pull request with a fix for this issue. Up to the AWS team to accept the pull request and merge into development and then release on master branch.