Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AIY Project, el día que le hablé a una caja

AIY Project, el día que le hablé a una caja

Charla sobre AIY Project dada en el GDD Extended del GDG Jaén el día 16 de Septiembre de 2017 y en el GDD Extended del GDG Granada el día 27 de Septiembre de 2017

David Sánchez Jiménez

September 27, 2017
Tweet

More Decks by David Sánchez Jiménez

Other Decks in Programming

Transcript

  1. Well, it’s kind of cold outside, so I'd like something

    to warm me up, like a hot soup, and I want it fast. I have some chicken, and also canned tomatoes.
  2. const app = new ApiAiApp({request: request, response: response}); const WELCOME_INTENT

    = 'input.welcome'; // the action name from the API.AI intent const NUMBER_INTENT = 'input.number'; // the action name from the API.AI intent const NUMBER_ARGUMENT = 'input.mynum'; // the action name from the API.AI intent function welcomeIntent (app) { app.ask('Welcome to action snippets! Say a number.'); } function numberIntent (app) { let number = app.getArgument(NUMBER_ARGUMENT); app.tell('You said ' + number); } let actionMap = new Map(); actionMap.set(WELCOME_INTENT, welcomeIntent); actionMap.set(NUMBER_INTENT, numberIntent); app.handleRequest(actionMap);
  3. const App = require('actions-on-google').ApiAiApp; exports.yourApp = (request, response) => {

    const app = new App({request, response}); console.log('Request headers: ' + JSON.stringify(request.headers)); console.log('Request body: ' + JSON.stringify(request.body)); // Fulfill action business logic function responseHandler (app) { // Complete your fulfillment logic and send a response app.ask('Hello, World!'); } const actionMap = new Map(); actionMap.set('<API.AI_action_name>', responseHandler); app.handleRequest(actionMap); };