@ai-sdk/svelte 3.0.0-canary.16 → 3.0.0-canary.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/svelte
2
2
 
3
+ ## 3.0.0-canary.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [a571d6e]
8
+ - Updated dependencies [c60f895]
9
+ - Updated dependencies [332167b]
10
+ - Updated dependencies [a8c8bd5]
11
+ - Updated dependencies [a662dea]
12
+ - Updated dependencies [41fa418]
13
+ - @ai-sdk/provider-utils@3.0.0-canary.15
14
+ - ai@5.0.0-canary.18
15
+
3
16
  ## 3.0.0-canary.16
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # AI SDK: Svelte provider
2
2
 
3
- [Svelte](https://svelte.dev/) UI components for the [AI SDK](https://sdk.vercel.ai/docs):
3
+ [Svelte](https://svelte.dev/) UI components for the [AI SDK](https://ai-sdk.dev/docs):
4
4
 
5
- - [`Chat`](https://sdk.vercel.ai/docs/reference/ai-sdk-ui/use-chat)
6
- - [`Completion`](https://sdk.vercel.ai/docs/reference/ai-sdk-ui/use-completion)
7
- - [`StructuredObject`](https://sdk.vercel.ai/docs/reference/ai-sdk-ui/use-object)
5
+ - [`Chat`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat)
6
+ - [`Completion`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-completion)
7
+ - [`StructuredObject`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-object)
8
8
 
9
- For information on the few ways the Svelte APIs differ from the React ones, see [the docs](https://sdk.vercel.ai/docs/getting-started/svelte#how-does-ai-sdksvelte-differ-from-ai-sdkreact)
9
+ For information on the few ways the Svelte APIs differ from the React ones, see [the docs](https://ai-sdk.dev/docs/getting-started/svelte#how-does-ai-sdksvelte-differ-from-ai-sdkreact)
@@ -1,13 +1,5 @@
1
1
  import { type ChatRequestOptions, type CreateUIMessage, type JSONValue, type UIMessage, type UseChatOptions } from 'ai';
2
- export type ChatOptions = Readonly<Omit<UseChatOptions, 'keepLastMessageOnError'> & {
3
- /**
4
- * Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
5
- * Must be at least 1.
6
- * A maximum number is required to prevent infinite loops in the case of misconfigured tools.
7
- * By default, it's set to 1, which means that only a single LLM call is made.
8
- * @default 1
9
- */
10
- maxSteps?: number;
2
+ export type ChatOptions = Readonly<UseChatOptions & {
11
3
  '~internal'?: {
12
4
  currentDate?: () => Date;
13
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"chat.svelte.d.ts","sourceRoot":"","sources":["../src/chat.svelte.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,IAAI,CAAC;AAQZ,MAAM,MAAM,WAAW,GAAG,QAAQ,CAChC,IAAI,CAAC,cAAc,EAAE,wBAAwB,CAAC,GAAG;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;KAC1B,CAAC;CACH,CACF,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAE3C,qBAAa,IAAI;;IAOf;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAoD;IAI/D;;;;OAIG;IACH,IAAI,IAAI,IAGQ,SAAS,EAAE,GAAG,SAAS,CADtC;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAEtC;IAED;;;;;;;OAOG;IACH,IAAI,MAAM,kDAET;IAED,0CAA0C;IAC1C,IAAI,KAAK,sBAER;IAED,mFAAmF;IACnF,KAAK,SAAqB;IAE1B;;;;;OAKG;IAC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AI,KAAK,sBAER;IAED,mFAAmF;IACnF,KAAK,SAAqB;IAE1B;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,SAAS,EAAE,CAE1B;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,EAE9B;IAED,OAAO,CAAC,WAAW,CAEjB;gBAEU,OAAO,GAAE,WAAgB;IAYrC;;;;;OAKG;IACH,MAAM,YACK,SAAS,GAAG,eAAe,4BACX,kBAAkB,mBAU3C;IAEF;;;;OAIG;IACH,MAAM,6BAAmC,kBAAkB,mBAezD;IAEF;;OAEG;IACH,IAAI,aASF;IAEF,qFAAqF;IACrF,YAAY,WACF;QAAE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,YAC9B,kBAAkB,GAAG;QAAE,KAAK,CAAC,EAAE,QAAQ,CAAA;KAAE,mBA2BlD;IAEF,aAAa,4BAGV;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;KACjB,mBAmBC;CA2FH"}
@@ -169,20 +169,12 @@ export class Chat {
169
169
  this.#abortController = abortController;
170
170
  // Optimistically update messages
171
171
  this.messages = messages;
172
- const constructedMessagesPayload = this.#options.sendExtraMessageFields
173
- ? messages
174
- : messages.map(({ role, content, annotations, parts }) => ({
175
- role,
176
- content,
177
- ...(annotations !== undefined && { annotations }),
178
- ...(parts !== undefined && { parts }),
179
- }));
180
172
  const existingData = this.data ?? [];
181
173
  await callChatApi({
182
174
  api: this.#api,
183
175
  body: {
184
176
  id: this.id,
185
- messages: constructedMessagesPayload,
177
+ messages,
186
178
  data: chatRequest.data,
187
179
  ...$state.snapshot(this.#options.body),
188
180
  ...chatRequest.body,
@@ -194,7 +186,6 @@ export class Chat {
194
186
  ...chatRequest.headers,
195
187
  },
196
188
  abortController: () => abortController,
197
- restoreMessagesOnFailure: () => { },
198
189
  onResponse: this.#options.onResponse,
199
190
  onUpdate: ({ message, data, replaceLastMessage }) => {
200
191
  this.#store.status = 'streaming';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/svelte",
3
- "version": "3.0.0-canary.16",
3
+ "version": "3.0.0-canary.17",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist",
@@ -36,8 +36,8 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@ai-sdk/provider-utils": "3.0.0-canary.14",
40
- "ai": "5.0.0-canary.17"
39
+ "ai": "5.0.0-canary.18",
40
+ "@ai-sdk/provider-utils": "3.0.0-canary.15"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -61,7 +61,7 @@
61
61
  "zod": "3.23.8",
62
62
  "@vercel/ai-tsconfig": "0.0.0"
63
63
  },
64
- "homepage": "https://sdk.vercel.ai/docs",
64
+ "homepage": "https://ai-sdk.dev/docs",
65
65
  "repository": {
66
66
  "type": "git",
67
67
  "url": "git+https://github.com/vercel/ai.git",
@@ -23,16 +23,7 @@ import {
23
23
  } from './chat-context.svelte.js';
24
24
 
25
25
  export type ChatOptions = Readonly<
26
- Omit<UseChatOptions, 'keepLastMessageOnError'> & {
27
- /**
28
- * Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
29
- * Must be at least 1.
30
- * A maximum number is required to prevent infinite loops in the case of misconfigured tools.
31
- * By default, it's set to 1, which means that only a single LLM call is made.
32
- * @default 1
33
- */
34
- maxSteps?: number;
35
-
26
+ UseChatOptions & {
36
27
  '~internal'?: {
37
28
  currentDate?: () => Date;
38
29
  };
@@ -249,21 +240,12 @@ export class Chat {
249
240
  // Optimistically update messages
250
241
  this.messages = messages;
251
242
 
252
- const constructedMessagesPayload = this.#options.sendExtraMessageFields
253
- ? messages
254
- : messages.map(({ role, content, annotations, parts }) => ({
255
- role,
256
- content,
257
- ...(annotations !== undefined && { annotations }),
258
- ...(parts !== undefined && { parts }),
259
- }));
260
-
261
243
  const existingData = this.data ?? [];
262
244
  await callChatApi({
263
245
  api: this.#api,
264
246
  body: {
265
247
  id: this.id,
266
- messages: constructedMessagesPayload,
248
+ messages,
267
249
  data: chatRequest.data,
268
250
  ...$state.snapshot(this.#options.body),
269
251
  ...chatRequest.body,
@@ -275,7 +257,6 @@ export class Chat {
275
257
  ...chatRequest.headers,
276
258
  },
277
259
  abortController: () => abortController,
278
- restoreMessagesOnFailure: () => {},
279
260
  onResponse: this.#options.onResponse,
280
261
  onUpdate: ({ message, data, replaceLastMessage }) => {
281
262
  this.#store.status = 'streaming';