modelmix 2.5.2 → 2.5.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/index.js +10 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -133,7 +133,7 @@ class MessageHandler {
|
|
|
133
133
|
console.error(`Error reading system message file ${filePath}:`, error);
|
|
134
134
|
}
|
|
135
135
|
return this;
|
|
136
|
-
}
|
|
136
|
+
}
|
|
137
137
|
|
|
138
138
|
addImage(filePath, config = { role: "user" }) {
|
|
139
139
|
try {
|
|
@@ -245,12 +245,14 @@ class MessageHandler {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
groupByRoles(messages) {
|
|
248
|
-
return messages.reduce((acc,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
return messages.reduce((acc, currentMessage, index) => {
|
|
249
|
+
if (index === 0 || currentMessage.role !== messages[index - 1].role) {
|
|
250
|
+
acc.push({
|
|
251
|
+
role: currentMessage.role,
|
|
252
|
+
content: currentMessage.content
|
|
253
|
+
});
|
|
252
254
|
} else {
|
|
253
|
-
acc.
|
|
255
|
+
acc[acc.length - 1].content = acc[acc.length - 1].content.concat(currentMessage.content);
|
|
254
256
|
}
|
|
255
257
|
return acc;
|
|
256
258
|
}, []);
|
|
@@ -379,7 +381,7 @@ class MixCustom {
|
|
|
379
381
|
};
|
|
380
382
|
|
|
381
383
|
return formattedError;
|
|
382
|
-
}
|
|
384
|
+
}
|
|
383
385
|
|
|
384
386
|
processStream(response) {
|
|
385
387
|
return new Promise((resolve, reject) => {
|
|
@@ -495,7 +497,7 @@ class MixAnthropic extends MixCustom {
|
|
|
495
497
|
create(args = { config: {}, options: {} }) {
|
|
496
498
|
args.options.system = args.config.system;
|
|
497
499
|
return super.create(args);
|
|
498
|
-
}
|
|
500
|
+
}
|
|
499
501
|
}
|
|
500
502
|
|
|
501
503
|
class MixPerplexity extends MixCustom {
|