我正在尝试将用户向我的QnA制造商机器人提出的新问题保存到Azure数据库中,以便可以将这些问题的答案添加到我的知识库中。
目前,我要求用户在未收到我的机器人回复的情况下以反馈形式写问题。这也花了一些时间,用户也因此而烦恼。我希望我的机器人收集这些问题并将其存储在数据库中。
因此,请指导如何实现这一目标,任何链接或建议都值得赞赏。
答案 0 :(得分:1)
我可以使用SharePoint列表实现类似的目的。
https://stackoverflow.com/a/56612401/9611859
如果您想对SharePoint列表添加否定答案,我设法使用csom-node程序包和Bot Framework v4 / NodeJS使其正常运行。当然,这不是最优雅的解决方案,但是它可以工作。
Bot.JS
const csomapi = require('../node_modules/csom-node');
settings = require('../settings').settings;
// Set CSOM settings
csomapi.setLoaderOptions({url: settings.siteurl});
再往下一点...
// If no answers were returned from QnA Maker, reply with help.
} else {
await context.sendActivity("Er sorry, I don't seem to have an answer.");
console.log(context.activity.text);
var response = context.activity.text;
var authCtx = new AuthenticationContext(settings.siteurl);
authCtx.acquireTokenForApp(settings.clientId, settings.clientSecret, function (err, data) {
var ctx = new SP.ClientContext("/sites/yoursite"); //set root web
authCtx.setAuthenticationCookie(ctx); //authenticate
var web = ctx.get_web();
var list = web.get_lists().getByTitle('YourList');
var creationInfo = new SP.ListItemCreationInformation();
var listItem = list.addItem(creationInfo);
listItem.set_item('Title', response);
listItem.update();
ctx.load(listItem);
ctx.executeQueryAsync();
});
}