wingbot 3.71.1 → 3.71.3
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 +2 -3
- package/src/LLM.js +1 -1
- package/src/LLMSession.js +1 -3
- package/src/Processor.js +10 -5
- package/src/resolvers/message.js +11 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wingbot",
|
|
3
|
-
"version": "3.71.
|
|
3
|
+
"version": "3.71.3",
|
|
4
4
|
"description": "Enterprise Messaging Bot Conversation Engine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"mocha": "^10.2.0",
|
|
52
52
|
"nyc": "^15.1.0",
|
|
53
53
|
"rimraf": "^5.0.5",
|
|
54
|
-
"sinon": "^17.0.1"
|
|
55
|
-
"tsd-jsdoc": "^2.5.0"
|
|
54
|
+
"sinon": "^17.0.1"
|
|
56
55
|
},
|
|
57
56
|
"dependencies": {
|
|
58
57
|
"@amplitude/ua-parser-js": "^0.7.33",
|
package/src/LLM.js
CHANGED
package/src/LLMSession.js
CHANGED
|
@@ -221,9 +221,7 @@ class LLMSession {
|
|
|
221
221
|
*/
|
|
222
222
|
messagesToSend (dontMarkAsSent = false) {
|
|
223
223
|
if (!this._generatedIndex) {
|
|
224
|
-
|
|
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);
|
package/src/Processor.js
CHANGED
|
@@ -405,13 +405,18 @@ class Processor extends EventEmitter {
|
|
|
405
405
|
return { status: 304 };
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
const
|
|
408
|
+
const llmOptions = {
|
|
409
409
|
provider: new LLMMockProvider(),
|
|
410
|
-
...(typeof messageSender.logPrompt === 'function'
|
|
411
|
-
? { logger: messageSender }
|
|
412
|
-
: {}),
|
|
413
410
|
...this.options.llm
|
|
414
|
-
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
if (typeof messageSender.logPrompt === 'function') {
|
|
414
|
+
Object.assign(llmOptions, {
|
|
415
|
+
logger: messageSender
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const llm = new LLM(llmOptions);
|
|
415
420
|
|
|
416
421
|
const result = await this
|
|
417
422
|
._dispatch(message, pageId, messageSender, responderData, preloadPromise, llm);
|
package/src/resolvers/message.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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);
|