이 코드를 작동하지 않는 자바 스크립트 외부로 전화를하면 잘 작동 내가 파괴하려고 할 때, 그러나캡슐화 API.ai 기능이
{ id: '2865abde-ac8f-4ac3-816e-483c68f709d0',
timestamp: '2016-11-08T22:38:56.461Z',
result:
{ source: 'agent',
resolvedQuery: 'jacket',
action: '',
actionIncomplete: false,
parameters: {},
contexts: [ [Object] ],
metadata:
{ intentId: '357af94f-00b3-4016-a661-732419ddafd6',
webhookUsed: 'false',
intentName: 'clothing' },
fulfillment: { speech: 'clothing2', messages: [Object] },
score: 0.6 },
status: { code: 200, errorType: 'success' },
sessionId: '123456' }
clothing2
clothing
을 이 떨어져 함수 호출에, 일이 잘 작동하지 않습니다
파일 : main.js
var apiai = require('apiai');
var app3 = apiai(<token>);
exports.getresponse = function(inputstring){
var request = app3.textRequest(inputstring, {'sessionId': 123456});
request.on('response', function(response) {
return(response);
});
request.on('error', function(error) {
return(error);
});
request.end();
};
파일 : 나는 moda.js (노드 moda.js)를 실행하면, 내가 콘솔 출력으로 만
undefined
얻을
var express = require("express");
var app = express();
var joe = require('./main.js');
console.log(joe.getresponse('jacket'));
app.listen(3000);
moda.js.
내가 뭘 잘못하고 있니?
감사합니다.
이 게시물에 api.ai 토큰을 공개했습니다. 반드시 토큰을 즉시 재생성해야합니다. https : //docs.api.ai/docs/authentication – Alan