我正在按照本教程使用 Recast AI 制作 FB 聊天机器人。尝试将我的机器人与令牌连接,但出现以下错误:
var client = new recastai(config.recast);
^
TypeError: recastai is not a function
at Object.<anonymous> (/home/ubuntu/workspace/app/pokebot.js:5:14)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:990:3
这是我的代码:
const config = require("./config.js");
const restify = require("restify");
const builder = require("botbuilder");
var recastai = require('recastai');
var client = new recastai(config.recast);
const connector = new builder.ChatConnector({
appId: config.appId,
appPassword: config.appPassword
});
bot.dialog("/", (session) => {
client.textRequest(session.message.text)
.then(res => console.log(res))
.catch(() => session.send('I need some some sleep right now.. Talk to me
later!'));
});
const server = restify.createServer();
server.listen(8080);
server.post("/", connector.listen());
谁能帮我?谢谢!