wingbot 3.73.7 → 3.73.9

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": "wingbot",
3
- "version": "3.73.7",
3
+ "version": "3.73.9",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -142,7 +142,7 @@ const DUMMY_ROUTE = { id: 0, path: null, resolvers: [] };
142
142
  * @prop {boolean} [allowForbiddenSnippetWords] - disable security rule
143
143
  * @prop {Middleware} [defaultPlugin] - to be able to test configurations without plugins
144
144
  * @prop {RouteConfig[]} [routeConfigs] - list of disabled routes
145
- * @prop {boolean|keyof ILogger} [canaryLogs]
145
+ * @prop {boolean|string} [canaryLogs]
146
146
  * @prop {ILogger} [log]
147
147
  * @prop {C} [configuration] - context data
148
148
  */
package/src/ChatGpt.js CHANGED
@@ -37,8 +37,8 @@ const LLM = require('./LLM');
37
37
  * @typedef {object} DefaultRequestOptions
38
38
  * @prop {ChatGPTModel} [model]
39
39
  * @prop {number} [presencePenalty=0.0]
40
- * @prop {number} [requestTokens=256]
41
- * @prop {number} [tokensLimit=4096]
40
+ * @prop {number} [requestTokens]
41
+ * @prop {number} [tokensLimit]
42
42
  * @prop {number} [temperature=1.0]
43
43
  * @prop {number} [transcriptLength=-5]
44
44
  */
@@ -189,8 +189,8 @@ class ChatGpt {
189
189
 
190
190
  /** @type {Required<DefaultRequestOptions>} */
191
191
  this._options = {
192
- requestTokens: 256,
193
- tokensLimit: 128000,
192
+ requestTokens: null,
193
+ tokensLimit: null,
194
194
  presencePenalty: 0.0, // -2.0-2.0
195
195
  temperature: 1.0,
196
196
  model: 'gpt-4o-mini',
@@ -304,7 +304,7 @@ class ChatGpt {
304
304
  return (m.content ? 0 : m.content.length) + total;
305
305
  }, 0);
306
306
 
307
- if (totalTokens > tokensLimit) {
307
+ if (tokensLimit !== null && totalTokens > tokensLimit) {
308
308
  messages = messages.filter((m, i) => {
309
309
  if (m.role === LLM.ROLE_SYSTEM
310
310
  || i >= lastUserIndex
@@ -322,7 +322,7 @@ class ChatGpt {
322
322
  model,
323
323
  frequency_penalty: 0,
324
324
  presence_penalty: presencePenalty,
325
- max_tokens: requestTokens,
325
+ ...(requestTokens ? { max_completion_tokens: requestTokens } : {}),
326
326
  temperature,
327
327
  messages
328
328
  };
@@ -461,35 +461,32 @@ function message (params, context = {}) {
461
461
  evaluation,
462
462
  session
463
463
  });
464
- if (isLastMessage && !req.actionData()._resolverTag) {
465
- res.finalMessageSent = true;
466
- }
467
- return ret;
468
- }
464
+ } else {
469
465
 
470
- if (evaluation.action) {
471
- postBack(evaluation.action);
472
- return Router.END;
473
- }
466
+ if (evaluation.action) {
467
+ postBack(evaluation.action);
468
+ return Router.END;
469
+ }
474
470
 
475
- // if (!response.content) {
476
- // // no response?
477
- // }
471
+ // if (!response.content) {
472
+ // // no response?
473
+ // }
478
474
 
479
- const messages = session.messagesToSend();
475
+ const messages = session.messagesToSend();
480
476
 
481
- res.setFlag(LLM.GPT_FLAG);
477
+ res.setFlag(LLM.GPT_FLAG);
482
478
 
483
- const lastMessageI = messages.length - 1;
484
- messages.forEach((m, i) => {
485
- if (lastMessageI === i) {
486
- text = m.content;
487
- } else {
488
- res.text(m.content, null, null, {
489
- disableAutoTyping: true
490
- });
491
- }
492
- });
479
+ const lastMessageI = messages.length - 1;
480
+ messages.forEach((m, i) => {
481
+ if (lastMessageI === i) {
482
+ text = m.content;
483
+ } else {
484
+ res.text(m.content, null, null, {
485
+ disableAutoTyping: true
486
+ });
487
+ }
488
+ });
489
+ }
493
490
  }
494
491
 
495
492
  res.text(text, sendReplies, voiceControl, {
@@ -13,7 +13,7 @@
13
13
  /**
14
14
  *
15
15
  * @param {ILogger} logger
16
- * @param {boolean|keyof ILogger} setting
16
+ * @param {boolean|string} setting
17
17
  * @param {string} message
18
18
  * @param {...*} args
19
19
  * @returns {void}