fix(kb.gbapp): #298 search fix and params.
This commit is contained in:
parent
2313006aed
commit
78778da3a7
5 changed files with 11 additions and 18 deletions
|
@ -121,7 +121,6 @@
|
|||
"node-html-parser": "^6.1.5",
|
||||
"node-nlp": "4.24.0",
|
||||
"node-tesseract-ocr": "2.2.1",
|
||||
"npm": "9.1.2",
|
||||
"open": "8.4.0",
|
||||
"open-docxtemplater-image-module": "^1.0.3",
|
||||
"pdf-extraction": "1.0.2",
|
||||
|
@ -144,11 +143,11 @@
|
|||
"rimraf": "3.0.2",
|
||||
"safe-buffer": "5.2.1",
|
||||
"scanf": "1.1.2",
|
||||
"sequelize": "6.25.7",
|
||||
"sequelize-cli": "6.5.2",
|
||||
"sequelize": "6.28.2",
|
||||
"sequelize-cli": "6.6.0",
|
||||
"sequelize-typescript": "2.1.5",
|
||||
"sharp": "^0.31.3",
|
||||
"simple-git": "3.15.0",
|
||||
"simple-git": "3.16.0",
|
||||
"speakingurl": "14.0.1",
|
||||
"ssr-for-bots": "1.0.1-c",
|
||||
"strict-password-generator": "1.1.2",
|
||||
|
@ -157,7 +156,7 @@
|
|||
"tedious": "15.1.2",
|
||||
"textract": "2.5.0",
|
||||
"twitter-api-v2": "1.12.9",
|
||||
"typescript": "4.9.3",
|
||||
"typescript": "4.9.5",
|
||||
"typescript-rest-rpc": "1.0.7",
|
||||
"url-join": "5.0.0",
|
||||
"vbscript-to-typescript": "1.0.8",
|
||||
|
|
|
@ -223,7 +223,7 @@ export class GBDeployer implements IGBDeployer {
|
|||
instance.activationCode = instance.botId;
|
||||
instance.state = 'active';
|
||||
instance.nlpScore = 0.8;
|
||||
instance.searchScore = 0.45;
|
||||
instance.searchScore = 0.25;
|
||||
instance.whatsappServiceKey = null;
|
||||
instance.whatsappServiceNumber = null;
|
||||
instance.whatsappServiceUrl = null;
|
||||
|
|
|
@ -170,8 +170,7 @@ export class FeedbackDialog extends IGBDialog {
|
|||
await sec.updateHumanAgent(userSystemId, min.instance.instanceId, null);
|
||||
await sec.updateHumanAgent(manualUser.userSystemId, min.instance.instanceId, null);
|
||||
|
||||
user = await sec.getUserFromSystemId(userSystemId);
|
||||
await min.userProfile.set(step.context, user);
|
||||
|
||||
} else if (user.agentMode === 'human') {
|
||||
const agent = await sec.getUserFromSystemId(user.agentSystemId);
|
||||
|
||||
|
@ -201,8 +200,6 @@ export class FeedbackDialog extends IGBDialog {
|
|||
await sec.updateHumanAgent(user.userSystemId, min.instance.instanceId, null);
|
||||
await sec.updateHumanAgent(agent.userSystemId, min.instance.instanceId, null);
|
||||
|
||||
user = await sec.getUserFromSystemId(userSystemId);
|
||||
await min.userProfile.set(step.context, user);
|
||||
} else {
|
||||
if (user.userSystemId.charAt(2) === ':' || userSystemId.indexOf('@') > -1) {
|
||||
// Agent is from Teams or Google Chat.
|
||||
|
|
|
@ -213,8 +213,6 @@ export class AskDialog extends IGBDialog {
|
|||
);
|
||||
|
||||
// TODO: https://github.com/GeneralBots/BotServer/issues/9 user.lastQuestion = text;
|
||||
await min.userProfile.set(step.context, user);
|
||||
|
||||
|
||||
const resultsA = await service.ask(min.instance, text, searchScore, null /* user.subjects */ );
|
||||
|
||||
|
@ -225,7 +223,7 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
// user.isAsking = false;
|
||||
// user.lastQuestionId = resultsA.questionId;
|
||||
await min.userProfile.set(step.context, user);
|
||||
|
||||
|
||||
// Sends the answer to all outputs, including projector.
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ export class KBService implements IGBKBService {
|
|||
subject4: string;
|
||||
}
|
||||
|
||||
const client = new SearchClient<SearchResults>('https://' + instance.searchHost, 'azuresql-index', {
|
||||
const client = new SearchClient<any>('https://' + instance.searchHost, 'azuresql-index', {
|
||||
key: instance.searchKey
|
||||
} as any);
|
||||
|
||||
|
@ -316,15 +316,14 @@ export class KBService implements IGBKBService {
|
|||
top: 1
|
||||
});
|
||||
|
||||
const values = results.results;
|
||||
let returnedScore = 0;
|
||||
|
||||
// Searches via Search (Azure Search).
|
||||
|
||||
let found = false;
|
||||
for await (const result of values) {
|
||||
for await (const result of results.results) {
|
||||
found = true;
|
||||
returnedScore = result['@search.score'];
|
||||
returnedScore = result.score;
|
||||
if (returnedScore >= searchScore) {
|
||||
const value = await this.getAnswerById(instance.instanceId, result.document.answerId);
|
||||
if (value !== null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue