@tiledesk/tiledesk-tybot-connector 2.0.21-rc1 → 2.0.21-rc3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.21-rc1",
3
+ "version": "2.0.21-rc3",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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 KbService {
5
+ class KBService {
6
6
 
7
7
  constructor() { }
8
8
 
@@ -45,7 +45,7 @@ class KbService {
45
45
 
46
46
  async getKeyFromKbSettings(id_project, token) {
47
47
 
48
- return new Promise((resolve, reject) => {
48
+ return new Promise((resolve) => {
49
49
  const http_request = {
50
50
  url: API_ENDPOINT + "/" + id_project + "/kbsettings",
51
51
  headers: {
@@ -59,8 +59,8 @@ class KbService {
59
59
  httpUtils.request(
60
60
  http_request, async (err, resbody) => {
61
61
  if (err) {
62
- winston.error("Error getting kb settings:", err);
63
- reject(err);
62
+ winston.error("Error getting kb settings:", err?.response?.data);
63
+ resolve(null);
64
64
  } else {
65
65
  if (!resbody || !resbody.gptkey) {
66
66
  resolve(null);
@@ -101,5 +101,5 @@ class KbService {
101
101
  }
102
102
  }
103
103
 
104
- const kbService = new KbService();
104
+ const kbService = new KBService();
105
105
  module.exports = kbService;
@@ -11,8 +11,9 @@ 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 kbService = require("../../services/KBService");
16
+
16
17
 
17
18
  class DirAskGPTV2 {
18
19
 
@@ -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 });