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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4d0c108: fix(ai/ui): convert provider metadata for system messages to model messages
8
+
3
9
  ## 5.0.0
4
10
 
5
11
  ### Major Changes
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: message.parts.map((part) => part.type === "text" ? part.text : "").join("")
9242
+ content: textParts.map((part) => part.text).join(""),
9243
+ ...Object.keys(providerMetadata).length > 0 ? { providerOptions: providerMetadata } : {}
9236
9244
  });
9237
9245
  break;
9238
9246
  }