wingbot 3.71.2 → 3.71.4

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.71.2",
3
+ "version": "3.71.4",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/LLM.js CHANGED
@@ -172,9 +172,9 @@ class LLM {
172
172
  */
173
173
  static toMessages (result) {
174
174
  let filtered = result.content
175
- .replace(/\n\n+/g, '\n')
176
- .split(/\n+(?!\s*-)/g)
177
- .map((t) => t.replace(/\n\s+/g, '\n')
175
+ .replace(/\n\n\n+/g, '\n\n')
176
+ .split(/\n\n+(?!\s*-)/g)
177
+ .map((t) => t.replace(/\s*\n\s+/g, '\n')
178
178
  .trim())
179
179
  .filter((t) => !!t);
180
180
 
package/src/LLMSession.js CHANGED
@@ -221,9 +221,7 @@ class LLMSession {
221
221
  */
222
222
  messagesToSend (dontMarkAsSent = false) {
223
223
  if (!this._generatedIndex) {
224
- // eslint-disable-next-line no-console
225
- console.log('LLMSession', this.toString());
226
- throw new Error('LLMSession: no message to send');
224
+ return [];
227
225
  }
228
226
 
229
227
  let messages = this._chat.splice(this._generatedIndex);
@@ -419,7 +419,7 @@ function message (params, context = {}) {
419
419
  if (params.type === 'prompt') {
420
420
  const session = await res.llmSessionWithHistory(params.llmContextType);
421
421
 
422
- const response = await session.systemPrompt(text)
422
+ await session.systemPrompt(text)
423
423
  .debug()
424
424
  .generate();
425
425
 
@@ -427,7 +427,16 @@ function message (params, context = {}) {
427
427
  // // no response?
428
428
  // }
429
429
 
430
- text = response.content;
430
+ const messages = session.messagesToSend();
431
+
432
+ const lastMessageI = messages.length - 1;
433
+ messages.forEach((m, i) => {
434
+ if (lastMessageI === i) {
435
+ text = m.content;
436
+ } else {
437
+ res.text(m.content);
438
+ }
439
+ });
431
440
  }
432
441
 
433
442
  res.text(text, sendReplies, voiceControl);