wingbot 3.76.4-alpha.13 → 3.76.4-alpha.15

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.76.4-alpha.13",
3
+ "version": "3.76.4-alpha.15",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/ChatGpt.js CHANGED
@@ -47,6 +47,7 @@ const LLM = require('./LLM');
47
47
  * @prop {ChatGPTModel} [model]
48
48
  * @prop {'none'|'low'|'medium'|'high'} [reasoningEffort]
49
49
  * @prop {number} [presencePenalty=0.0]
50
+ * @prop {number} [frequencyPenalty=0.0]
50
51
  * @prop {number} [requestTokens]
51
52
  * @prop {number} [tokensLimit]
52
53
  * @prop {number} [temperature=1.0]
@@ -209,6 +210,7 @@ class ChatGpt {
209
210
  requestTokens: null,
210
211
  tokensLimit: null,
211
212
  presencePenalty: 0.0, // -2.0-2.0
213
+ frequencyPenalty: 0.0, // -2.0-2.0
212
214
  temperature: 1.0,
213
215
  model: 'gpt-4o-mini',
214
216
  transcriptLength: -5,
@@ -305,6 +307,7 @@ class ChatGpt {
305
307
  tokensLimit,
306
308
  model,
307
309
  presencePenalty,
310
+ frequencyPenalty,
308
311
  temperature,
309
312
  reasoningEffort,
310
313
  functions = [],
@@ -403,7 +406,7 @@ class ChatGpt {
403
406
 
404
407
  body = {
405
408
  model,
406
- frequency_penalty: 0,
409
+ frequency_penalty: frequencyPenalty ?? 0,
407
410
  presence_penalty: presencePenalty,
408
411
  ...(requestTokens ? {
409
412
  max_completion_tokens: requestTokens
package/src/LLM.js CHANGED
@@ -107,6 +107,8 @@ const LLMSession = require('./LLMSession');
107
107
  * @prop {'low'|'medium'|'high'|string} [verbosity]
108
108
  * @prop {'text'|SimpleJsonSchema} [responseFormat]
109
109
  * @prop {number} [temperature]
110
+ * @prop {number} [presencePenalty]
111
+ * @prop {number} [frequencyPenalty]
110
112
  * @prop {number} [maxToolCallRounds]
111
113
  */
112
114
 
@@ -16,13 +16,19 @@ function extractText (payload) {
16
16
  return payload.message.text;
17
17
  }
18
18
 
19
- // button message
20
- if (payload.message && payload.message.attachment
21
- && payload.message.attachment.type === 'template'
22
- && payload.message.attachment.payload
23
- && payload.message.attachment.payload.text) {
24
-
25
- return payload.message.attachment.payload.text;
19
+ // button message — the orchestrator normalizes a singular `attachment` into
20
+ // a plural `attachments` array before persisting, so accept both shapes;
21
+ // otherwise template messages (e.g. button templates) logged via the
22
+ // orchestrator drop out of the transcript entirely.
23
+ const attachment = payload.message
24
+ && (payload.message.attachment
25
+ || (Array.isArray(payload.message.attachments) && payload.message.attachments[0]));
26
+ if (attachment
27
+ && attachment.type === 'template'
28
+ && attachment.payload
29
+ && attachment.payload.text) {
30
+
31
+ return attachment.payload.text;
26
32
  }
27
33
 
28
34
  if (!payload.postback) {