Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
Fix simulator response for Dialogflow v1
Browse files Browse the repository at this point in the history
Change-Id: I0bf05d05d53ef4468d97939f37ac5ffe28a1b132
  • Loading branch information
Canain committed Oct 5, 2018
1 parent e73f470 commit 8489e37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/service/dialogflow/_test/conv.v1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ test('conv.serialize w/ simple response has fulfillmentText when from simulator'
},
},
},
displayText: response,
speech: response,
})
})

Expand Down Expand Up @@ -164,7 +164,7 @@ test('conv.serialize w/ simple response text has fulfillmentText when from simul
},
},
},
displayText: text,
speech: text,
})
})

Expand Down Expand Up @@ -194,7 +194,7 @@ test('conv.serialize w/ two simple responses has fulfillmentText warning for sim
},
},
},
displayText: 'Cannot display response in Dialogflow simulator. ' +
speech: 'Cannot display response in Dialogflow simulator. ' +
'Please test on the Google Assistant simulator instead.',
})
})
Expand Down Expand Up @@ -232,7 +232,7 @@ test('conv.serialize w/ solo helper has fulfillmentText warning for simulator',
},
},
},
displayText: 'Cannot display response in Dialogflow simulator. ' +
speech: 'Cannot display response in Dialogflow simulator. ' +
'Please test on the Google Assistant simulator instead.',
})
})
Expand Down Expand Up @@ -298,7 +298,7 @@ test('conv.serialize w/ non solo helper has fulfillmentText warning for simulato
},
},
},
displayText: 'Cannot display response in Dialogflow simulator. ' +
speech: 'Cannot display response in Dialogflow simulator. ' +
'Please test on the Google Assistant simulator instead.',
})
})
Expand Down Expand Up @@ -336,7 +336,7 @@ test('conv.serialize w/ image has fulfillmentText warning for simulator', t => {
},
},
},
displayText: 'Cannot display response in Dialogflow simulator. ' +
speech: 'Cannot display response in Dialogflow simulator. ' +
'Please test on the Google Assistant simulator instead.',
})
})
Expand Down
4 changes: 3 additions & 1 deletion src/service/dialogflow/conv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ export class DialogflowConversation<
}
if (simulator && payload) {
const items = payload.google.richResponse.items!
response.displayText =
// Simulator only shows speech response
// Since this is only shown to the simulator as text, the speech is the displayText
response.speech =
(payload.google.systemIntent || items.length > 1) ?
SIMULATOR_WARNING :
(items[0].simpleResponse!.displayText ||
Expand Down

0 comments on commit 8489e37

Please sign in to comment.