Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/svelte

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/svelte - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

8

CHANGELOG.md
# @ai-sdk/svelte
## 0.0.15
### 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.14

@@ -4,0 +12,0 @@

27

dist/index.js

@@ -34,3 +34,2 @@ "use strict";

var getStreamedResponse = async (api, chatRequest, mutate, mutateStreamData, existingData, extraMetadata, previousMessages, abortControllerRef, generateId2, streamMode, onFinish, onResponse, sendExtraMessageFields, fetch2) => {
var _a, _b;
mutate(chatRequest.messages);

@@ -65,3 +64,3 @@ const constructedMessagesPayload = sendExtraMessageFields ? chatRequest.messages : chatRequest.messages.map(

...extraMetadata.body,
...(_a = chatRequest.options) == null ? void 0 : _a.body,
...chatRequest.body,
...chatRequest.functions !== void 0 && {

@@ -84,3 +83,3 @@ functions: chatRequest.functions

...extraMetadata.headers,
...(_b = chatRequest.options) == null ? void 0 : _b.headers
...chatRequest.headers
},

@@ -200,3 +199,5 @@ abortController: () => abortControllerRef,

tool_choice,
data: data2
data: data2,
headers: headers2,
body: body2
} = {}) => {

@@ -206,5 +207,11 @@ if (!message.id) {

}
const requestOptions = {
headers: headers2 != null ? headers2 : options == null ? void 0 : options.headers,
body: body2 != null ? body2 : options == null ? void 0 : options.body
};
const chatRequest = {
messages: (0, import_store.get)(messages).concat(message),
options,
options: requestOptions,
headers: requestOptions.headers,
body: requestOptions.body,
data: data2,

@@ -261,5 +268,9 @@ ...functions !== void 0 && { functions },

const handleSubmit = (event, options = {}) => {
var _a;
var _a, _b, _c, _d, _e;
(_a = event == null ? void 0 : event.preventDefault) == null ? void 0 : _a.call(event);
const inputValue = (0, import_store.get)(input);
const requestOptions = {
headers: (_c = options.headers) != null ? _c : (_b = options.options) == null ? void 0 : _b.headers,
body: (_e = options.body) != null ? _e : (_d = options.options) == null ? void 0 : _d.body
};
const chatRequest = {

@@ -272,3 +283,5 @@ messages: inputValue ? (0, import_store.get)(messages).concat({

}) : (0, import_store.get)(messages),
options: options.options,
options: requestOptions,
body: requestOptions.body,
headers: requestOptions.headers,
data: options.data

@@ -275,0 +288,0 @@ };

{
"name": "@ai-sdk/svelte",
"version": "0.0.14",
"version": "0.0.15",
"license": "Apache-2.0",

@@ -19,3 +19,3 @@ "sideEffects": false,

"@ai-sdk/provider-utils": "1.0.2",
"@ai-sdk/ui-utils": "0.0.11",
"@ai-sdk/ui-utils": "0.0.12",
"sswr": "2.1.0"

@@ -22,0 +22,0 @@ },

@@ -122,3 +122,3 @@ import type {

...extraMetadata.body,
...chatRequest.options?.body,
...chatRequest.body,
...(chatRequest.functions !== undefined && {

@@ -141,3 +141,3 @@ functions: chatRequest.functions,

...extraMetadata.headers,
...chatRequest.options?.headers,
...chatRequest.headers,
},

@@ -286,2 +286,4 @@ abortController: () => abortControllerRef,

data,
headers,
body,
}: ChatRequestOptions = {},

@@ -293,5 +295,12 @@ ) => {

const requestOptions = {
headers: headers ?? options?.headers,
body: body ?? options?.body,
};
const chatRequest: ChatRequest = {
messages: get(messages).concat(message as Message),
options,
options: requestOptions,
headers: requestOptions.headers,
body: requestOptions.body,
data,

@@ -362,2 +371,7 @@ ...(functions !== undefined && { functions }),

const requestOptions = {
headers: options.headers ?? options.options?.headers,
body: options.body ?? options.options?.body,
};
const chatRequest: ChatRequest = {

@@ -372,3 +386,5 @@ messages: inputValue

: get(messages),
options: options.options,
options: requestOptions,
body: requestOptions.body,
headers: requestOptions.headers,
data: options.data,

@@ -375,0 +391,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc