Skip to content

Commit

Permalink
Facebook Thread hand off to Inbox
Browse files Browse the repository at this point in the history
  • Loading branch information
docwho2 committed Dec 9, 2023
1 parent c9e06b0 commit 83e8159
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:
- name: Gummy Bear Test
shell: bash
run: |
RESULT=$(aws lexv2-runtime recognize-text --text 'If you have gummy bears, respond with exactly "AFFIRMATIVE"' --output text --query 'messages[-1:].content' --bot-id ${BOT_ID} --bot-alias-id ${BOT_ALIAS_ID} --locale-id en_US --session-id ${{ inputs.session-id }})
RESULT=$(aws lexv2-runtime recognize-text --text 'If you have gummy bears, respond with exactly "AFFIRMATIVE"' --output text --query 'messages[0].content' --bot-id ${BOT_ID} --bot-alias-id ${BOT_ALIAS_ID} --locale-id en_US --session-id ${{ inputs.session-id }})
echo "Result is [${RESULT}]"
if [[ $RESULT != *"AFFIRMATIVE"* ]]; then
echo "Did not pass gummy bear test"
Expand All @@ -55,7 +55,7 @@ runs:
- name: Muggs Restaurant Test
shell: bash
run: |
RESULT=$(aws lexv2-runtime recognize-text --text 'Please recommend a restaurant in the area?' --output text --query 'messages[-1:].content' --bot-id ${BOT_ID} --bot-alias-id ${BOT_ALIAS_ID} --locale-id en_US --session-id ${{ inputs.session-id }})
RESULT=$(aws lexv2-runtime recognize-text --text 'Please recommend a restaurant in the area?' --output text --query 'messages[0].content' --bot-id ${BOT_ID} --bot-alias-id ${BOT_ALIAS_ID} --locale-id en_US --session-id ${{ inputs.session-id }})
echo "Result is [${RESULT}]"
if [[ $RESULT != *"Mugg"* ]]; then
echo "Did not pass Mugg's restaurant test"
Expand All @@ -70,7 +70,7 @@ runs:
- name: Address Test
shell: bash
run: |
RESULT=$(aws lexv2-runtime recognize-text --text 'What is your address?' --output text --query 'messages[-1:].content' --bot-id ${BOT_ID} --bot-alias-id ${BOT_ALIAS_ID} --locale-id en_US --session-id ${{ inputs.session-id }})
RESULT=$(aws lexv2-runtime recognize-text --text 'What is your address?' --output text --query 'messages[0].content' --bot-id ${BOT_ID} --bot-alias-id ${BOT_ALIAS_ID} --locale-id en_US --session-id ${{ inputs.session-id }})
echo "Result is [${RESULT}]"
if [[ $RESULT != *"160 Main"* ]]; then
echo "Did not pass Address Test"
Expand Down
14 changes: 7 additions & 7 deletions ChatGPT/src/main/java/cloud/cleo/squareup/ChatGPTLambda.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,20 @@ private LexV2Response buildResponse(LexV2Event lexRequest, String response, Imag

final var messages = new LinkedList<LexV2Response.Message>();

if (card != null) {
// Always send a plain text response
messages.add(LexV2Response.Message.builder()
.withContentType("PlainText")
.withContent(response)
.build());

if (card != null) {
// If we are going to send a Card, we will send ahead of message
messages.add(LexV2Response.Message.builder()
.withContentType("ImageResponseCard")
.withImageResponseCard(card)
.build());
}

// Always send a plain text response
messages.add(LexV2Response.Message.builder()
.withContentType("PlainText")
.withContent(response)
.build());

// State to return
final var ss = SessionState.builder()
// Retain the current session attributes
Expand Down

0 comments on commit 83e8159

Please sign in to comment.