@ai-sdk/ui-utils
Advanced tools
Comparing version 0.0.49 to 0.0.50
@@ -772,3 +772,3 @@ "use strict"; | ||
const data = []; | ||
let message_annotations = void 0; | ||
let messageAnnotations = void 0; | ||
const partialToolCalls = {}; | ||
@@ -805,3 +805,3 @@ let usage = { | ||
} | ||
if (nextPrefixMap && (type === "text" || type === "tool_call" || type === "tool_call_streaming_start" || type === "tool_call_delta" || type === "tool_result")) { | ||
if (nextPrefixMap != null && (type === "text" || type === "tool_call" || type === "tool_call_streaming_start" || type === "tool_call_delta" || type === "tool_result")) { | ||
if (prefixMap.text) { | ||
@@ -942,34 +942,36 @@ previousMessages.push(prefixMap.text); | ||
if (type === "message_annotations") { | ||
if (!message_annotations) { | ||
message_annotations = [...value]; | ||
if (!messageAnnotations) { | ||
messageAnnotations = [...value]; | ||
} else { | ||
message_annotations.push(...value); | ||
messageAnnotations.push(...value); | ||
} | ||
functionCallMessage = assignAnnotationsToMessage( | ||
prefixMap["function_call"], | ||
message_annotations | ||
messageAnnotations | ||
); | ||
toolCallMessage = assignAnnotationsToMessage( | ||
prefixMap["tool_calls"], | ||
message_annotations | ||
messageAnnotations | ||
); | ||
responseMessage = assignAnnotationsToMessage( | ||
prefixMap["text"], | ||
message_annotations | ||
messageAnnotations | ||
); | ||
prefixMap.text.internalUpdateId = generateId2(); | ||
if (prefixMap.text != null) { | ||
prefixMap.text.internalUpdateId = generateId2(); | ||
} | ||
} | ||
if (message_annotations == null ? void 0 : message_annotations.length) { | ||
if (messageAnnotations == null ? void 0 : messageAnnotations.length) { | ||
if (prefixMap.text) { | ||
prefixMap.text.annotations = [...message_annotations]; | ||
prefixMap.text.annotations = [...messageAnnotations]; | ||
} | ||
if (prefixMap.function_call) { | ||
prefixMap.function_call.annotations = [...message_annotations]; | ||
prefixMap.function_call.annotations = [...messageAnnotations]; | ||
} | ||
if (prefixMap.tool_calls) { | ||
prefixMap.tool_calls.annotations = [...message_annotations]; | ||
prefixMap.tool_calls.annotations = [...messageAnnotations]; | ||
} | ||
} | ||
const merged = [functionCallMessage, toolCallMessage, responseMessage].filter(Boolean).map((message) => ({ | ||
...assignAnnotationsToMessage(message, message_annotations) | ||
...assignAnnotationsToMessage(message, messageAnnotations) | ||
})); | ||
@@ -976,0 +978,0 @@ update([...previousMessages, ...merged], [...data]); |
# @ai-sdk/ui-utils | ||
## 0.0.50 | ||
### Patch Changes | ||
- a85c965: fix (ai/ui): send message annotations from onChunk | ||
## 0.0.49 | ||
@@ -4,0 +10,0 @@ |
@@ -772,3 +772,3 @@ "use strict"; | ||
const data = []; | ||
let message_annotations = void 0; | ||
let messageAnnotations = void 0; | ||
const partialToolCalls = {}; | ||
@@ -805,3 +805,3 @@ let usage = { | ||
} | ||
if (nextPrefixMap && (type === "text" || type === "tool_call" || type === "tool_call_streaming_start" || type === "tool_call_delta" || type === "tool_result")) { | ||
if (nextPrefixMap != null && (type === "text" || type === "tool_call" || type === "tool_call_streaming_start" || type === "tool_call_delta" || type === "tool_result")) { | ||
if (prefixMap.text) { | ||
@@ -942,34 +942,36 @@ previousMessages.push(prefixMap.text); | ||
if (type === "message_annotations") { | ||
if (!message_annotations) { | ||
message_annotations = [...value]; | ||
if (!messageAnnotations) { | ||
messageAnnotations = [...value]; | ||
} else { | ||
message_annotations.push(...value); | ||
messageAnnotations.push(...value); | ||
} | ||
functionCallMessage = assignAnnotationsToMessage( | ||
prefixMap["function_call"], | ||
message_annotations | ||
messageAnnotations | ||
); | ||
toolCallMessage = assignAnnotationsToMessage( | ||
prefixMap["tool_calls"], | ||
message_annotations | ||
messageAnnotations | ||
); | ||
responseMessage = assignAnnotationsToMessage( | ||
prefixMap["text"], | ||
message_annotations | ||
messageAnnotations | ||
); | ||
prefixMap.text.internalUpdateId = generateId2(); | ||
if (prefixMap.text != null) { | ||
prefixMap.text.internalUpdateId = generateId2(); | ||
} | ||
} | ||
if (message_annotations == null ? void 0 : message_annotations.length) { | ||
if (messageAnnotations == null ? void 0 : messageAnnotations.length) { | ||
if (prefixMap.text) { | ||
prefixMap.text.annotations = [...message_annotations]; | ||
prefixMap.text.annotations = [...messageAnnotations]; | ||
} | ||
if (prefixMap.function_call) { | ||
prefixMap.function_call.annotations = [...message_annotations]; | ||
prefixMap.function_call.annotations = [...messageAnnotations]; | ||
} | ||
if (prefixMap.tool_calls) { | ||
prefixMap.tool_calls.annotations = [...message_annotations]; | ||
prefixMap.tool_calls.annotations = [...messageAnnotations]; | ||
} | ||
} | ||
const merged = [functionCallMessage, toolCallMessage, responseMessage].filter(Boolean).map((message) => ({ | ||
...assignAnnotationsToMessage(message, message_annotations) | ||
...assignAnnotationsToMessage(message, messageAnnotations) | ||
})); | ||
@@ -976,0 +978,0 @@ update([...previousMessages, ...merged], [...data]); |
{ | ||
"name": "@ai-sdk/ui-utils", | ||
"version": "0.0.49", | ||
"version": "0.0.50", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4074682
37735