wingbot 3.70.0-alpha.5 → 3.70.0-alpha.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/LLMSession.js +19 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.70.0-alpha.5",
3
+ "version": "3.70.0-alpha.6",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/LLMSession.js CHANGED
@@ -203,10 +203,10 @@ class LLMSession {
203
203
 
204
204
  /**
205
205
  *
206
- * @param {QuickReply[]} quickReplies
207
- * @returns {this}
206
+ * @param {boolean} [dontMarkAsSent=false]
207
+ * @returns {LLMMessage[]}
208
208
  */
209
- send (quickReplies = undefined) {
209
+ messagesToSend (dontMarkAsSent = false) {
210
210
  if (!this._generatedIndex) {
211
211
  // eslint-disable-next-line no-console
212
212
  console.log('LLMSession', this.toString());
@@ -215,9 +215,25 @@ class LLMSession {
215
215
 
216
216
  let messages = this._chat.splice(this._generatedIndex);
217
217
  messages = messages.flatMap((msg) => LLM.toMessages(msg));
218
+
219
+ if (dontMarkAsSent) {
220
+ return messages;
221
+ }
222
+
218
223
  this._generatedIndex = null;
219
224
  this._chat.push(...messages);
220
225
 
226
+ return messages;
227
+ }
228
+
229
+ /**
230
+ *
231
+ * @param {QuickReply[]} quickReplies
232
+ * @returns {this}
233
+ */
234
+ send (quickReplies = undefined) {
235
+ const messages = this.messagesToSend();
236
+
221
237
  this._onSend(messages, quickReplies);
222
238
 
223
239
  return this;