@ai-sdk/svelte 3.0.0-canary.16 → 3.0.0-canary.18
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 +25 -0
- package/README.md +5 -5
- package/dist/chat.svelte.d.ts +1 -9
- package/dist/chat.svelte.d.ts.map +1 -1
- package/dist/chat.svelte.js +1 -11
- package/package.json +4 -4
- package/src/chat.svelte.ts +2 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @ai-sdk/svelte
|
|
2
2
|
|
|
3
|
+
## 3.0.0-canary.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2d03e19]
|
|
8
|
+
- Updated dependencies [319b989]
|
|
9
|
+
- Updated dependencies [441d042]
|
|
10
|
+
- Updated dependencies [dcc549b]
|
|
11
|
+
- Updated dependencies [cb2b53a]
|
|
12
|
+
- Updated dependencies [e244a78]
|
|
13
|
+
- ai@5.0.0-canary.19
|
|
14
|
+
|
|
15
|
+
## 3.0.0-canary.17
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [a571d6e]
|
|
20
|
+
- Updated dependencies [c60f895]
|
|
21
|
+
- Updated dependencies [332167b]
|
|
22
|
+
- Updated dependencies [a8c8bd5]
|
|
23
|
+
- Updated dependencies [a662dea]
|
|
24
|
+
- Updated dependencies [41fa418]
|
|
25
|
+
- @ai-sdk/provider-utils@3.0.0-canary.15
|
|
26
|
+
- ai@5.0.0-canary.18
|
|
27
|
+
|
|
3
28
|
## 3.0.0-canary.16
|
|
4
29
|
|
|
5
30
|
### 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.
|
|
3
|
+
[Svelte](https://svelte.dev/) UI components for the [AI SDK](https://ai-sdk.dev/docs):
|
|
4
4
|
|
|
5
|
-
- [`Chat`](https://sdk.
|
|
6
|
-
- [`Completion`](https://sdk.
|
|
7
|
-
- [`StructuredObject`](https://sdk.
|
|
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.
|
|
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)
|
package/dist/chat.svelte.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { type ChatRequestOptions, type CreateUIMessage, type JSONValue, type UIMessage, type UseChatOptions } from 'ai';
|
|
2
|
-
export type ChatOptions = Readonly<
|
|
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,M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,EAAE,QAAQ,CAAA;KAAE,mBA0BlD;IAEF,aAAa,4BAGV;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;KACjB,mBAmBC;CA2FH"}
|
package/dist/chat.svelte.js
CHANGED
|
@@ -129,7 +129,6 @@ export class Chat {
|
|
|
129
129
|
id: this.#generateId(),
|
|
130
130
|
createdAt: this.currentDate(),
|
|
131
131
|
role: 'user',
|
|
132
|
-
content: this.input,
|
|
133
132
|
parts: [...fileParts, { type: 'text', text: this.input }],
|
|
134
133
|
});
|
|
135
134
|
const chatRequest = {
|
|
@@ -169,20 +168,12 @@ export class Chat {
|
|
|
169
168
|
this.#abortController = abortController;
|
|
170
169
|
// Optimistically update messages
|
|
171
170
|
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
171
|
const existingData = this.data ?? [];
|
|
181
172
|
await callChatApi({
|
|
182
173
|
api: this.#api,
|
|
183
174
|
body: {
|
|
184
175
|
id: this.id,
|
|
185
|
-
messages
|
|
176
|
+
messages,
|
|
186
177
|
data: chatRequest.data,
|
|
187
178
|
...$state.snapshot(this.#options.body),
|
|
188
179
|
...chatRequest.body,
|
|
@@ -194,7 +185,6 @@ export class Chat {
|
|
|
194
185
|
...chatRequest.headers,
|
|
195
186
|
},
|
|
196
187
|
abortController: () => abortController,
|
|
197
|
-
restoreMessagesOnFailure: () => { },
|
|
198
188
|
onResponse: this.#options.onResponse,
|
|
199
189
|
onUpdate: ({ message, data, replaceLastMessage }) => {
|
|
200
190
|
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.
|
|
3
|
+
"version": "3.0.0-canary.18",
|
|
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.
|
|
40
|
-
"ai": "5.0.0-canary.
|
|
39
|
+
"@ai-sdk/provider-utils": "3.0.0-canary.15",
|
|
40
|
+
"ai": "5.0.0-canary.19"
|
|
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.
|
|
64
|
+
"homepage": "https://ai-sdk.dev/docs",
|
|
65
65
|
"repository": {
|
|
66
66
|
"type": "git",
|
|
67
67
|
"url": "git+https://github.com/vercel/ai.git",
|
package/src/chat.svelte.ts
CHANGED
|
@@ -23,16 +23,7 @@ import {
|
|
|
23
23
|
} from './chat-context.svelte.js';
|
|
24
24
|
|
|
25
25
|
export type ChatOptions = Readonly<
|
|
26
|
-
|
|
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
|
};
|
|
@@ -189,7 +180,6 @@ export class Chat {
|
|
|
189
180
|
id: this.#generateId(),
|
|
190
181
|
createdAt: this.currentDate(),
|
|
191
182
|
role: 'user',
|
|
192
|
-
content: this.input,
|
|
193
183
|
parts: [...fileParts, { type: 'text', text: this.input }],
|
|
194
184
|
});
|
|
195
185
|
|
|
@@ -249,21 +239,12 @@ export class Chat {
|
|
|
249
239
|
// Optimistically update messages
|
|
250
240
|
this.messages = messages;
|
|
251
241
|
|
|
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
242
|
const existingData = this.data ?? [];
|
|
262
243
|
await callChatApi({
|
|
263
244
|
api: this.#api,
|
|
264
245
|
body: {
|
|
265
246
|
id: this.id,
|
|
266
|
-
messages
|
|
247
|
+
messages,
|
|
267
248
|
data: chatRequest.data,
|
|
268
249
|
...$state.snapshot(this.#options.body),
|
|
269
250
|
...chatRequest.body,
|
|
@@ -275,7 +256,6 @@ export class Chat {
|
|
|
275
256
|
...chatRequest.headers,
|
|
276
257
|
},
|
|
277
258
|
abortController: () => abortController,
|
|
278
|
-
restoreMessagesOnFailure: () => {},
|
|
279
259
|
onResponse: this.#options.onResponse,
|
|
280
260
|
onUpdate: ({ message, data, replaceLastMessage }) => {
|
|
281
261
|
this.#store.status = 'streaming';
|