@tiledesk/tiledesk-tybot-connector 2.0.21-rc2 → 2.0.21-rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ const httpUtils = require('../utils/HttpUtils');
|
|
|
2
2
|
const winston = require('../utils/winston');
|
|
3
3
|
const API_ENDPOINT = process.env.API_ENDPOINT;
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class LLMService {
|
|
6
6
|
|
|
7
7
|
constructor() { }
|
|
8
8
|
|
|
@@ -101,5 +101,5 @@ class KbService {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
const
|
|
105
|
-
module.exports =
|
|
104
|
+
const llmService = new LLMService();
|
|
105
|
+
module.exports = llmService;
|
|
@@ -11,8 +11,10 @@ const winston = require('../../utils/winston');
|
|
|
11
11
|
const httpUtils = require("../../utils/HttpUtils");
|
|
12
12
|
const integrationService = require("../../services/IntegrationService");
|
|
13
13
|
const { Logger } = require("../../Logger");
|
|
14
|
-
const kbService = require("../../services/KBService");
|
|
15
14
|
const quotasService = require("../../services/QuotasService");
|
|
15
|
+
const llmService = require("../../services/LLMService");
|
|
16
|
+
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
class DirAskGPTV2 {
|
|
18
20
|
|
|
@@ -174,7 +176,7 @@ class DirAskGPTV2 {
|
|
|
174
176
|
if (!key) {
|
|
175
177
|
this.logger.native("[Ask Knowledge Base] OpenAI key not found in Integration. Using shared OpenAI key");
|
|
176
178
|
winston.verbose("DirAskGPTV2 - Key not found in Integrations. Searching in kb settings...");
|
|
177
|
-
key = await
|
|
179
|
+
key = await llmService.getKeyFromKbSettings(this.projectId, this.token);
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
if (!key) {
|
|
@@ -357,7 +359,7 @@ class DirAskGPTV2 {
|
|
|
357
359
|
}
|
|
358
360
|
} else {
|
|
359
361
|
await this.#assignAttributes(action, answer, source);
|
|
360
|
-
|
|
362
|
+
llmService.addUnansweredQuestion(this.projectId, json.namespace, json.question, this.token).catch((err) => {
|
|
361
363
|
winston.error("DirAskGPTV2 - Error adding unanswered question: ", err);
|
|
362
364
|
this.logger.warn("[Ask Knowledge Base] Unable to add unanswered question", json.question, "to namespacae", json.namespace);
|
|
363
365
|
})
|
|
@@ -19,8 +19,6 @@ class DirReply {
|
|
|
19
19
|
this.tdcache = context.tdcache;
|
|
20
20
|
this.log = context.log;
|
|
21
21
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
22
|
-
|
|
23
|
-
console.log("context.supportRequest: ", context.supportRequest);
|
|
24
22
|
|
|
25
23
|
this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
|
|
26
24
|
this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
|