Sprint1 master (#97)
* PBI4 End Updates PBI4 End Updates * pbi4end fabrikam updates * v4 update v4 update * updates and cleaning * remove htmldecoding remove htmldecoding * move qnamaker host and uri to appsettings move qnamaker host and uri to appsettings * Update Web.config * add debug traces to log output add debug traces to log output * remove function htmldecode remove function htmldecode
This commit is contained in:
Родитель
4523fa9c49
Коммит
5fbdaec2a8
|
@ -25,13 +25,15 @@ namespace AdatumTaxCorpKnowledgeService.Controllers
|
|||
public JsonResult FindTaxAnswer(QnaMakerQuestion inquiry)
|
||||
{
|
||||
JsonResult result;
|
||||
string kbIdName = "knowledgeBaseID";
|
||||
string keyName = "authorization";
|
||||
string host = "qnaHost";
|
||||
string uri = "qnaUri";
|
||||
string contentTypeName = "Content-Type";
|
||||
string contentTypeValue = "application/json";
|
||||
|
||||
var kbIdValue = WebConfigurationManager.AppSettings[kbIdName];
|
||||
var keyValue = WebConfigurationManager.AppSettings[keyName];
|
||||
var hostValue = WebConfigurationManager.AppSettings[host];
|
||||
var uriValue = WebConfigurationManager.AppSettings[uri];
|
||||
|
||||
if (inquiry.Question is null || inquiry.Question == "")
|
||||
{
|
||||
|
@ -39,7 +41,7 @@ namespace AdatumTaxCorpKnowledgeService.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
string url = $"https://adatumtaxcorpknowledgebot.azurewebsites.net/qnamaker/knowledgebases/{kbIdValue}/generateAnswer";
|
||||
string url = $"{hostValue}{uriValue}";
|
||||
string body = JsonConvert.SerializeObject(inquiry);
|
||||
|
||||
using (WebClient client = new WebClient())
|
||||
|
|
|
@ -27,7 +27,6 @@ $(document).ready(function () {
|
|||
answer = ob.answers[0].answer;
|
||||
score = ob.answers[0].score;
|
||||
matchingquestions = ob.answers[0].questions;
|
||||
answer = htmlDecode(answer);
|
||||
|
||||
answerHtml = "<div>" + answer + "</div><br /><div><hr><br /><hr><h4>Score:</h4>" + score + "</div><br /><div><h4>Matching Questions:</h4>" + matchingquestions + "</div>";
|
||||
|
||||
|
@ -55,10 +54,3 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function htmlDecode(input) {
|
||||
var temp = document.createElement('div');
|
||||
temp.innerHTML = input;
|
||||
return temp.childNodes[0].nodeValue;
|
||||
}
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
<add key="knowledgeBaseID" value="933e690b-cd8d-4fb6-a40e-f9fd6ddc69b1" />
|
||||
<add key="Ocp-Apim-Subscription-Key" value="e22543d04ffe4de5acff82544e7804f3" />
|
||||
-->
|
||||
<!-- TIED TO DB QnA Maker Knowledge Base ID & Subscription key -->
|
||||
<add key="knowledgeBaseID" value="28b77470-2b54-47e0-85cf-40c662458c8e" />
|
||||
<!-- QnA Maker Host & Uri & Endpoint key -->
|
||||
<add key="authorization" value="EndpointKey ef0fe005-c705-46b9-afde-b611d18e0157" />
|
||||
<add key="qnaHost" value="https://adatumtaxcorpknowledgebot.azurewebsites.net/qnamaker" />
|
||||
<add key="qnaUri" value="/knowledgebases/4e64969e-103b-4c3e-9a8d-fcfc8531ce42/generateAnswer" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.7.1" />
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Bot.Builder;
|
||||
using Microsoft.Bot.Builder.Dialogs;
|
||||
using Microsoft.Bot.Schema;
|
||||
|
@ -25,6 +26,9 @@ namespace ContosoHelpdeskChatBot
|
|||
|
||||
public ContosoChatBot(ConsotoChatBotAccessors accessors)
|
||||
{
|
||||
// Log to log stream
|
||||
Trace.TraceError("Contoso Chat Bot initialized.");
|
||||
|
||||
_accessors = accessors ?? throw new System.ArgumentNullException(nameof(accessors));
|
||||
|
||||
// Create top - level dialog(s)
|
||||
|
@ -83,6 +87,10 @@ namespace ContosoHelpdeskChatBot
|
|||
}
|
||||
catch (Exception ex) // For production would want to catch more specific exception
|
||||
{
|
||||
// Log to log stream
|
||||
Trace.TraceError("Error from within the code in OnTurnAsync function in ContosoChatBot.cs:");
|
||||
Trace.TraceError(ex.Message);
|
||||
|
||||
logger.Error(ex);
|
||||
|
||||
await turnContext.SendActivityAsync("An error occured, cancelling.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче