Permalink
Browse files

switch option lists to suggestion chips

  • Loading branch information...
TothiViseo committed Oct 11, 2017
1 parent a4e9d85 commit bd35c7e3c63e4ff89173ba3850ed7e2195060d64
Showing with 6 additions and 12 deletions.
  1. +6 −12 node-red-contrib-api-ai/server-api-ai.js
@@ -343,8 +343,7 @@ const getGoogleMessage = exports.getGoogleMessage = (replies, context) => {
}

if (reply.type === 'quick'){
let item = { title: reply.title, items: [] };

google.richResponse.suggestions = [];
// A unique key that will be sent back to the agent if this response is given.
// https://developers.google.com/actions/reference/rest/Shared.Types/OptionInfo
for (let button of reply.buttons){
@@ -364,25 +363,20 @@ const getGoogleMessage = exports.getGoogleMessage = (replies, context) => {
}

let btn = {}
item.items.push(btn);

google.richResponse.suggestions.push(btn);

if ("string" === typeof button) {
btn.title = button
btn.optionInfo = { key: button, synonyms: [button] }
// btn.optionInfo = { key: button, synonyms: [button] }
} else {
btn.title = button.title
btn.optionInfo = { key: button.value, synonyms: [button.title] }
//btn.optionInfo = { key: button.value, synonyms: [button.title] }
}
// btn.description = ''
// btn.image = ''
}

google.systemIntent = {
intent: "actions.intent.OPTION",
data: {
"@type":"type.googleapis.com/google.actions.v2.OptionValueSpec"
}
}
google.systemIntent.data.listSelect = item;

}

0 comments on commit bd35c7e

Please sign in to comment.