wingbot 3.70.5 → 3.70.6

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.70.5",
3
+ "version": "3.70.6",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/LLM.js CHANGED
@@ -123,7 +123,7 @@ class LLM {
123
123
  async generate (session, options = {}) {
124
124
  /** @type {LLMProviderOptions} */
125
125
  const opts = {
126
- ...(this._configuration.model && { model: this._configuration.model }),
126
+ model: this._configuration.model,
127
127
  ...options
128
128
  };
129
129
 
@@ -141,9 +141,8 @@ class LLM {
141
141
  static toMessages (result) {
142
142
  let filtered = result.content
143
143
  .replace(/\n\n+/g, '\n')
144
- .split(/\n+(?!\s*-)/g)
145
- .map((t) => t.replace(/\n\s+/g, '\n')
146
- .trim())
144
+ .split(/\n+(?!-)/g)
145
+ .map((t) => t.trim())
147
146
  .filter((t) => !!t);
148
147
 
149
148
  if (result.finishReason === 'length' && filtered.length <= 0) {
package/src/LLMSession.js CHANGED
@@ -80,11 +80,13 @@ class LLMSession {
80
80
 
81
81
  const promptRegex = /\$\{prompt\(\)\}/g;
82
82
 
83
+ const last = sysMessages.length - 1;
84
+
83
85
  const content = sysMessages.reduce((reduced, current, i) => {
84
86
  if (i === 0) {
85
87
  return current.content || '';
86
88
  }
87
- if (!reduced.match(promptRegex)) {
89
+ if (last === i && !reduced.match(promptRegex)) {
88
90
  return `${reduced}\n\n${current.content}`;
89
91
  }
90
92
  return reduced.replace(promptRegex, current.content).trim();