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.19 to 0.0.20

9

CHANGELOG.md
# @ai-sdk/svelte
## 0.0.20
### Patch Changes
- f63829fe: feat (ai/ui): add allowEmptySubmit flag to handleSubmit
- 4b2c09d9: feat (ai/ui): add mutator function support to useChat / setMessages
- Updated dependencies [f63829fe]
- @ai-sdk/ui-utils@0.0.17
## 0.0.19

@@ -4,0 +13,0 @@

2

dist/index.d.ts

@@ -32,3 +32,3 @@ import { Message, CreateMessage, ChatRequestOptions, JSONValue, UseChatOptions, RequestOptions, UseCompletionOptions, AssistantStatus, UseAssistantOptions } from '@ai-sdk/ui-utils';

*/
setMessages: (messages: Message[]) => void;
setMessages: (messages: Message[] | ((messages: Message[]) => Message[])) => void;
/** The current value of the input */

@@ -35,0 +35,0 @@ input: Writable<string>;

@@ -262,4 +262,7 @@ "use strict";

};
const setMessages = (messages2) => {
mutate(messages2);
const setMessages = (messagesArg) => {
if (typeof messagesArg === "function") {
messagesArg = messagesArg((0, import_store.get)(messages));
}
mutate(messagesArg);
};

@@ -271,2 +274,4 @@ const input = (0, import_store.writable)(initialInput);

const inputValue = (0, import_store.get)(input);
if (!inputValue && !options.allowEmptySubmit)
return;
const requestOptions = {

@@ -277,3 +282,3 @@ headers: (_c = options.headers) != null ? _c : (_b = options.options) == null ? void 0 : _b.headers,

const chatRequest = {
messages: inputValue ? (0, import_store.get)(messages).concat({
messages: !inputValue && options.allowEmptySubmit ? (0, import_store.get)(messages) : (0, import_store.get)(messages).concat({
id: generateId2(),

@@ -283,3 +288,3 @@ content: inputValue,

createdAt: /* @__PURE__ */ new Date()
}) : (0, import_store.get)(messages),
}),
options: requestOptions,

@@ -286,0 +291,0 @@ body: requestOptions.body,

{
"name": "@ai-sdk/svelte",
"version": "0.0.19",
"version": "0.0.20",
"license": "Apache-2.0",

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

"@ai-sdk/provider-utils": "1.0.2",
"@ai-sdk/ui-utils": "0.0.16",
"@ai-sdk/ui-utils": "0.0.17",
"sswr": "2.1.0"

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

@@ -52,3 +52,6 @@ import type {

*/
setMessages: (messages: Message[]) => void;
setMessages: (
messages: Message[] | ((messages: Message[]) => Message[]),
) => void;
/** The current value of the input */

@@ -360,4 +363,10 @@ input: Writable<string>;

const setMessages = (messages: Message[]) => {
mutate(messages);
const setMessages = (
messagesArg: Message[] | ((messages: Message[]) => Message[]),
) => {
if (typeof messagesArg === 'function') {
messagesArg = messagesArg(get(messages));
}
mutate(messagesArg);
};

@@ -374,2 +383,4 @@

if (!inputValue && !options.allowEmptySubmit) return;
const requestOptions = {

@@ -381,10 +392,11 @@ headers: options.headers ?? options.options?.headers,

const chatRequest: ChatRequest = {
messages: inputValue
? get(messages).concat({
id: generateId(),
content: inputValue,
role: 'user',
createdAt: new Date(),
} as Message)
: get(messages),
messages:
!inputValue && options.allowEmptySubmit
? get(messages)
: get(messages).concat({
id: generateId(),
content: inputValue,
role: 'user',
createdAt: new Date(),
} as Message),
options: requestOptions,

@@ -391,0 +403,0 @@ body: requestOptions.body,

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

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