Save question when no answer is available for that question (new question) in QnA Maker Knowledge Base

主宰稳场 提交于 2020-06-17 15:06:31

问题


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.


回答1:


I was able to achieve something similar using a SharePoint list.

https://stackoverflow.com/a/56612401/9611859

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});

Bit further down the page...

// 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();
                });
            }


来源:https://stackoverflow.com/questions/56904731/save-question-when-no-answer-is-available-for-that-question-new-question-in-qn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!