@tiledesk/tiledesk-tybot-connector 2.0.21-rc3 → 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;
|
|
@@ -12,7 +12,8 @@ const httpUtils = require("../../utils/HttpUtils");
|
|
|
12
12
|
const integrationService = require("../../services/IntegrationService");
|
|
13
13
|
const { Logger } = require("../../Logger");
|
|
14
14
|
const quotasService = require("../../services/QuotasService");
|
|
15
|
-
const
|
|
15
|
+
const llmService = require("../../services/LLMService");
|
|
16
|
+
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class DirAskGPTV2 {
|
|
@@ -175,7 +176,7 @@ class DirAskGPTV2 {
|
|
|
175
176
|
if (!key) {
|
|
176
177
|
this.logger.native("[Ask Knowledge Base] OpenAI key not found in Integration. Using shared OpenAI key");
|
|
177
178
|
winston.verbose("DirAskGPTV2 - Key not found in Integrations. Searching in kb settings...");
|
|
178
|
-
key = await
|
|
179
|
+
key = await llmService.getKeyFromKbSettings(this.projectId, this.token);
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
if (!key) {
|
|
@@ -358,7 +359,7 @@ class DirAskGPTV2 {
|
|
|
358
359
|
}
|
|
359
360
|
} else {
|
|
360
361
|
await this.#assignAttributes(action, answer, source);
|
|
361
|
-
|
|
362
|
+
llmService.addUnansweredQuestion(this.projectId, json.namespace, json.question, this.token).catch((err) => {
|
|
362
363
|
winston.error("DirAskGPTV2 - Error adding unanswered question: ", err);
|
|
363
364
|
this.logger.warn("[Ask Knowledge Base] Unable to add unanswered question", json.question, "to namespacae", json.namespace);
|
|
364
365
|
})
|