@tiledesk/tiledesk-tybot-connector 0.2.65 → 0.2.66-rc2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
+ # v0.2.66-rc2
9
+ - changed updateQuotes method
10
+ - fix missing model in updateQuote
11
+
12
+ # v0.2.66-rc1
13
+ - fix missing model in updateQuote
8
14
 
9
15
  # v0.2.65
10
16
  - fix OPENAI_APIKEY: removed Bearer prefix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.65",
3
+ "version": "0.2.66-rc2",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,13 +24,14 @@
24
24
  "handlebars": "^4.7.7",
25
25
  "jsonschema": "^1.4.1",
26
26
  "jsonwebtoken": "^8.5.1",
27
+ "liquidjs": "^10.8.4",
27
28
  "minimist-string": "^1.0.2",
28
29
  "mongoose": "^6.3.5",
30
+ "multer": "^1.4.5-lts.1",
29
31
  "nanoid": "^3.1.25",
30
32
  "redis": "^3.1.2",
31
33
  "uuid": "^3.3.3",
32
- "vm2": "^3.9.13",
33
- "liquidjs": "^10.8.4"
34
+ "vm2": "^3.9.13"
34
35
  },
35
36
  "devDependencies": {
36
37
  "mocha": "^8.4.0"
@@ -196,8 +196,11 @@ class DirAskGPTV2 {
196
196
  else if (resbody.success === true) {
197
197
 
198
198
  if (publicKey === true) {
199
- let token_usage = resbody.prompt_token_size;
200
- this.updateQuote(server_base_url, token_usage);
199
+ let tokens_usage = {
200
+ tokens: resbody.prompt_token_size,
201
+ model: json.model
202
+ }
203
+ this.updateQuote(server_base_url, tokens_usage);
201
204
  }
202
205
 
203
206
  if (trueIntent) {
@@ -424,7 +427,7 @@ class DirAskGPTV2 {
424
427
  })
425
428
  }
426
429
 
427
- async updateQuote(server_base_url, tokens) {
430
+ async updateQuote(server_base_url, tokens_usage) {
428
431
  return new Promise((resolve) => {
429
432
 
430
433
  const HTTPREQUEST = {
@@ -433,7 +436,7 @@ class DirAskGPTV2 {
433
436
  'Content-Type': 'application/json',
434
437
  'Authorization': 'JWT ' + this.context.token
435
438
  },
436
- json: { tokens: tokens },
439
+ json: tokens_usage,
437
440
  method: "POST"
438
441
  }
439
442
  if (this.log) { console.log("DirAskGPT check quote availability HTTPREQUEST", HTTPREQUEST); }
@@ -57,6 +57,7 @@ class DirGptTask {
57
57
 
58
58
  // default value
59
59
  let answer = "No answer.";
60
+ let model = "gpt-3.5-turbo";
60
61
 
61
62
  if (!action.question || action.question === '') {
62
63
  console.error("Error: DirGptTask question attribute is mandatory. Executing condition false...")
@@ -81,6 +82,10 @@ class DirGptTask {
81
82
 
82
83
  let max_tokens = action.max_tokens;
83
84
  let temperature = action.temperature;
85
+
86
+ if (action.model) {
87
+ model = action.model;
88
+ }
84
89
 
85
90
  if (this.log) {
86
91
  console.log("DirGptTask max_tokens: ", max_tokens);
@@ -180,7 +185,10 @@ class DirGptTask {
180
185
  await this.#assignAttributes(action, answer_json);
181
186
 
182
187
  if (publicKey === true) {
183
- let token_usage = resbody.usage.total_tokens;
188
+ let token_usage = {
189
+ tokens: resbody.usage.total_tokens,
190
+ model: json.model
191
+ }
184
192
  this.updateQuote(server_base_url, token_usage);
185
193
  }
186
194