@ai-sdk/react
Advanced tools
Comparing version 0.0.29 to 0.0.30
# @ai-sdk/react | ||
## 0.0.30 | ||
### Patch Changes | ||
- b2bee4c5: fix (ai/ui): send data, body, headers in useChat().reload | ||
## 0.0.29 | ||
@@ -4,0 +10,0 @@ |
@@ -478,6 +478,13 @@ "use strict"; | ||
tools, | ||
tool_choice | ||
tool_choice, | ||
data, | ||
headers: headers2, | ||
body: body2 | ||
} = {}) => { | ||
if (messagesRef.current.length === 0) | ||
return null; | ||
const requestOptions = { | ||
headers: headers2 != null ? headers2 : options == null ? void 0 : options.headers, | ||
body: body2 != null ? body2 : options == null ? void 0 : options.body | ||
}; | ||
const lastMessage = messagesRef.current[messagesRef.current.length - 1]; | ||
@@ -487,3 +494,6 @@ if (lastMessage.role === "assistant") { | ||
messages: messagesRef.current.slice(0, -1), | ||
options, | ||
options: requestOptions, | ||
headers: requestOptions.headers, | ||
body: requestOptions.body, | ||
data, | ||
...functions !== void 0 && { functions }, | ||
@@ -498,3 +508,6 @@ ...function_call !== void 0 && { function_call }, | ||
messages: messagesRef.current, | ||
options, | ||
options: requestOptions, | ||
headers: requestOptions.headers, | ||
body: requestOptions.body, | ||
data, | ||
...functions !== void 0 && { functions }, | ||
@@ -501,0 +514,0 @@ ...function_call !== void 0 && { function_call }, |
{ | ||
"name": "@ai-sdk/react", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -241,4 +241,4 @@ import type { | ||
An automatic tool call roundtrip is a call to the server with the | ||
tool call results when all tool calls in the last assistant | ||
An automatic tool call roundtrip is a call to the server with the | ||
tool call results when all tool calls in the last assistant | ||
message have results. | ||
@@ -473,5 +473,13 @@ | ||
tool_choice, | ||
data, | ||
headers, | ||
body, | ||
}: ChatRequestOptions = {}) => { | ||
if (messagesRef.current.length === 0) return null; | ||
const requestOptions = { | ||
headers: headers ?? options?.headers, | ||
body: body ?? options?.body, | ||
}; | ||
// Remove last assistant message and retry last user message. | ||
@@ -482,3 +490,6 @@ const lastMessage = messagesRef.current[messagesRef.current.length - 1]; | ||
messages: messagesRef.current.slice(0, -1), | ||
options, | ||
options: requestOptions, | ||
headers: requestOptions.headers, | ||
body: requestOptions.body, | ||
data, | ||
...(functions !== undefined && { functions }), | ||
@@ -495,3 +506,6 @@ ...(function_call !== undefined && { function_call }), | ||
messages: messagesRef.current, | ||
options, | ||
options: requestOptions, | ||
headers: requestOptions.headers, | ||
body: requestOptions.body, | ||
data, | ||
...(functions !== undefined && { functions }), | ||
@@ -674,3 +688,3 @@ ...(function_call !== undefined && { function_call }), | ||
/** | ||
Check if the message is an assistant message with completed tool calls. | ||
Check if the message is an assistant message with completed tool calls. | ||
The message must have at least one tool invocation and all tool invocations | ||
@@ -677,0 +691,0 @@ must have a result. |
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
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
287709
5014