Skip to content

Commit

Permalink
feat: Add support for generic (#200)
Browse files Browse the repository at this point in the history
From generic will fully support:
* text
* image
* options
* pause

car workspace now has:
* Image response has now been added for amenity locations
* Pause response has now been added for out of scope amentiy locations eg find a school
* Value 0 is now handled for amenity location selection
* Entity created to handle 0 value for amenity selection
  • Loading branch information
Steve Green authored and germanattanasio committed Sep 18, 2018
1 parent d239235 commit 88678d9
Show file tree
Hide file tree
Showing 12 changed files with 1,472 additions and 1,441 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ temp/
coverage
.env
npm-debug.log
.jshintrc
.jshintrc
.DS_Store
20 changes: 0 additions & 20 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,6 @@ app.post('/api/message', function (req, res) {
return res.status(err.code || 500).json(err);
}

// This is a fix for now, as since Assistant version 2018-07-10,
// output text can now be in output.generic.text
var output = data.output;
if (output.text.length === 0 && output.hasOwnProperty('generic')) {
var generic = output.generic;

if (Array.isArray(generic)) {
// Loop through generic and add all text to data.output.text.
// If there are multiple responses, this will add all of them
// to the response.
for(var i = 0; i < generic.length; i++) {
if (generic[i].hasOwnProperty('text')) {
data.output.text.push(generic[i].text);
} else if (generic[i].hasOwnProperty('title')) {
data.output.text.push(generic[i].title);
}
}
}
}

return res.json(updateMessage(payload, data));
});
});
Expand Down
Loading

0 comments on commit 88678d9

Please sign in to comment.