Bot Framework Emulator
[18:48:31] -> POST 202 [conversationUpdate]
[18:48:31] -> POST 202 [conversationUpdate]
[18:48:36] -> POST 202 [message] hello
[18:48:37] Warning: The Bot Framework State API is not recommended for production environments, and may be deprecated in a
future release. Learn how to implement your own storage adapter.
[18:48:37] <- GET 200 getPrivateConversationData
[18:48:37] <- GET 200 getUserData
[18:48:37] <- GET 200 getConversationData
[18:48:37] <- POST 200 setPrivateConversationData
[18:48:37] <- POST 200 Reply[event] Debug Event
我是 Microsoft bot 框架的新手,正在尝试使用 QnA maker 构建基本 bot
但我被困在将 QnA 制造商服务与app.js
.
没有得到 QnA 制造商的回复。
$ nodemon app.js
[nodemon] 1.17.5
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
restify listening to http://[::]:3978
WARN: ChatConnector: receive - emulator running without security enabled.
ChatConnector: message received.
WARN: ChatConnector: receive - emulator running without security enabled.
ChatConnector: message received.
WARN: ChatConnector: receive - emulator running without security enabled.
ChatConnector: message received.
The Bot State API is deprecated. Please refer to https://aka.ms/I6swrh for details on how to replace with your own storage.
UniversalBot("*") routing "hello" from "emulator"
Session.beginDialog(/)
/ - Session.sendBatch() sending 0 message(s)
The Bot State API is deprecated. Please refer to https://aka.ms/I6swrh for details on how to replace with your own storage.
应用程序.js
const restify = require('restify');
const builder = require('botbuilder');
const cognitiveServices = require('botbuilder-cognitiveservices');
//connecting to server
const server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978,
function () {
console.log('%s listening to %s',server.name,server.url);
}
);
const connector = new builder.ChatConnector({
appId: process.env.MicrosoftAppId,
appPassword: process.env.MicrosoftAppPassword
});
//listening post from server
server.post('/api/messages', connector.listen());
var bot = new builder.UniversalBot(connector);
const recognizer = new cognitiveServices.QnAMakerRecognizer({
knowledgeBaseId: "ffek8d39-dldc-48df-a9db-d902efc18cda",
subscriptionKey: "881jc9eb-1a5b-4a10-bi89-233afh83ce98",
});
const qnaMakerDialog = new cognitiveServices.QnAMakerDialog({
recognizers: [recognizer],
defaultMessage: "Sorry I don't understand the question",
qnaThreshold: 0.4,
});
bot.dialog('/', qnaMakerDialog);