wingbot 3.70.4 → 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 +1 -1
- package/src/BuildRouter.js +1 -1
- package/src/LLM.js +3 -4
- package/src/LLMSession.js +3 -1
package/package.json
CHANGED
package/src/BuildRouter.js
CHANGED
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
|
-
|
|
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+(
|
|
145
|
-
.map((t) => t.
|
|
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();
|