@ai-sdk/vue
Advanced tools
Comparing version 0.0.13 to 0.0.14
# @ai-sdk/vue | ||
## 0.0.14 | ||
### Patch Changes | ||
- 56bbc2a7: feat (ai/ui): set body and headers directly on options for handleSubmit and append | ||
- Updated dependencies [56bbc2a7] | ||
- @ai-sdk/ui-utils@0.0.12 | ||
## 0.0.13 | ||
@@ -4,0 +12,0 @@ |
@@ -83,3 +83,3 @@ "use strict"; | ||
let abortController = null; | ||
async function triggerRequest(messagesSnapshot, { options, data } = {}) { | ||
async function triggerRequest(messagesSnapshot, { options, data, headers: headers2, body: body2 } = {}) { | ||
try { | ||
@@ -91,5 +91,11 @@ error.value = void 0; | ||
mutate(messagesSnapshot); | ||
const requestOptions = { | ||
headers: headers2 != null ? headers2 : options == null ? void 0 : options.headers, | ||
body: body2 != null ? body2 : options == null ? void 0 : options.body | ||
}; | ||
let chatRequest = { | ||
messages: messagesSnapshot, | ||
options, | ||
options: requestOptions, | ||
body: requestOptions.body, | ||
headers: requestOptions.headers, | ||
data | ||
@@ -124,10 +130,10 @@ }; | ||
data: chatRequest.data, | ||
...(0, import_vue.unref)(body), | ||
...(0, import_vue.unref)(body2), | ||
// Use unref to unwrap the ref value | ||
...options == null ? void 0 : options.body | ||
...requestOptions.body | ||
}, | ||
streamMode, | ||
headers: { | ||
...headers, | ||
...options == null ? void 0 : options.headers | ||
...headers2, | ||
...requestOptions.headers | ||
}, | ||
@@ -175,5 +181,10 @@ abortController: () => abortController, | ||
const append = async (message, options) => { | ||
var _a2, _b2, _c, _d; | ||
if (!message.id) { | ||
message.id = generateId(); | ||
} | ||
const requestOptions = { | ||
headers: (_b2 = options == null ? void 0 : options.headers) != null ? _b2 : (_a2 = options == null ? void 0 : options.options) == null ? void 0 : _a2.headers, | ||
body: (_d = options == null ? void 0 : options.body) != null ? _d : (_c = options == null ? void 0 : options.options) == null ? void 0 : _c.body | ||
}; | ||
return triggerRequest(messages.value.concat(message), options); | ||
@@ -180,0 +191,0 @@ }; |
{ | ||
"name": "@ai-sdk/vue", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"license": "Apache-2.0", | ||
@@ -18,3 +18,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@ai-sdk/ui-utils": "0.0.11", | ||
"@ai-sdk/ui-utils": "0.0.12", | ||
"swrv": "1.0.4" | ||
@@ -21,0 +21,0 @@ }, |
@@ -122,3 +122,3 @@ import type { | ||
messagesSnapshot: Message[], | ||
{ options, data }: ChatRequestOptions = {}, | ||
{ options, data, headers, body }: ChatRequestOptions = {}, | ||
) { | ||
@@ -136,5 +136,12 @@ try { | ||
const requestOptions = { | ||
headers: headers ?? options?.headers, | ||
body: body ?? options?.body, | ||
}; | ||
let chatRequest: ChatRequest = { | ||
messages: messagesSnapshot, | ||
options, | ||
options: requestOptions, | ||
body: requestOptions.body, | ||
headers: requestOptions.headers, | ||
data, | ||
@@ -174,3 +181,3 @@ }; | ||
...unref(body), // Use unref to unwrap the ref value | ||
...options?.body, | ||
...requestOptions.body, | ||
}, | ||
@@ -180,3 +187,3 @@ streamMode, | ||
...headers, | ||
...options?.headers, | ||
...requestOptions.headers, | ||
}, | ||
@@ -234,2 +241,8 @@ abortController: () => abortController, | ||
} | ||
const requestOptions = { | ||
headers: options?.headers ?? options?.options?.headers, | ||
body: options?.body ?? options?.options?.body, | ||
}; | ||
return triggerRequest(messages.value.concat(message as Message), options); | ||
@@ -236,0 +249,0 @@ }; |
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
96601
1422
+ Added@ai-sdk/ui-utils@0.0.12(transitive)
- Removed@ai-sdk/ui-utils@0.0.11(transitive)
Updated@ai-sdk/ui-utils@0.0.12