ai 5.0.0 → 5.0.1
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/CHANGELOG.md +6 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
@@ -9230,9 +9230,17 @@ function convertToModelMessages(messages, options) {
|
|
9230
9230
|
for (const message of messages) {
|
9231
9231
|
switch (message.role) {
|
9232
9232
|
case "system": {
|
9233
|
+
const textParts = message.parts.filter((part) => part.type === "text");
|
9234
|
+
const providerMetadata = textParts.reduce((acc, part) => {
|
9235
|
+
if (part.providerMetadata != null) {
|
9236
|
+
return { ...acc, ...part.providerMetadata };
|
9237
|
+
}
|
9238
|
+
return acc;
|
9239
|
+
}, {});
|
9233
9240
|
modelMessages.push({
|
9234
9241
|
role: "system",
|
9235
|
-
content:
|
9242
|
+
content: textParts.map((part) => part.text).join(""),
|
9243
|
+
...Object.keys(providerMetadata).length > 0 ? { providerOptions: providerMetadata } : {}
|
9236
9244
|
});
|
9237
9245
|
break;
|
9238
9246
|
}
|