问题描述
我正在尝试将用户向我的QnA制造商机器人提出的新问题保存到Azure数据库中,以便可以将这些问题的答案添加到我的知识库中.
I am trying to save the new questions asked by the user to my QnA maker bot into an Azure database so that I can add the answers to those questions to my knowledge base.
当前,我要求用户在未收到我的机器人回复的情况下以反馈形式写问题.这也花了一些时间,用户也因此而烦恼.我希望我的机器人收集这些问题并将其存储在数据库中.
Currently, I am asking the users to write their question in a feedback form when they don't get a response from my bot. This is taking make time also the user is annoyed by writing. I want my bot to collect these questions and store it a database.
因此,请指导如何实现这一目标,任何链接或建议都值得赞赏.
So, please guide how to achieve this, any links or suggestions appreciated.
推荐答案
使用SharePoint列表,我可以实现类似的目的.
I was able to achieve something similar using a SharePoint list.
https://stackoverflow.com/a/56612401/9611859
如果您想对SharePoint列表添加否定答案,我设法使用csom-node程序包和Bot Framework v4/NodeJS使其正常运行.当然,这不是最优雅的解决方案,但是它可以工作.
If you want to add a no answer to a SharePoint List, I managed to get it working using the csom-node package and Bot Framework v4 / NodeJS. Granted, it's not the most elegant solution, but it works.
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();
});
}
这篇关于当QnA Maker知识库中没有针对该问题(新问题)的答案时,保存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!