@ai-sdk/svelte 3.0.0-canary.17 → 3.0.0-canary.19
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 +34 -0
- package/dist/chat.svelte.d.ts.map +1 -1
- package/dist/chat.svelte.js +0 -1
- package/dist/completion.svelte.d.ts +2 -2
- package/dist/completion.svelte.d.ts.map +1 -1
- package/dist/completion.svelte.js +1 -1
- package/package.json +3 -3
- package/src/chat.svelte.ts +12 -4
- package/src/completion.svelte.ts +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @ai-sdk/svelte
|
|
2
2
|
|
|
3
|
+
## 3.0.0-canary.19
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 496bbc1: chore (ui): inline/remove ChatRequest type
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [13fef90]
|
|
12
|
+
- Updated dependencies [e90d45d]
|
|
13
|
+
- Updated dependencies [bc3109f]
|
|
14
|
+
- Updated dependencies [496bbc1]
|
|
15
|
+
- Updated dependencies [da70d79]
|
|
16
|
+
- Updated dependencies [bcea599]
|
|
17
|
+
- Updated dependencies [48d675a]
|
|
18
|
+
- Updated dependencies [c7710a9]
|
|
19
|
+
- Updated dependencies [87b828f]
|
|
20
|
+
- Updated dependencies [35fc02c]
|
|
21
|
+
- Updated dependencies [b983b51]
|
|
22
|
+
- ai@5.0.0-canary.20
|
|
23
|
+
- @ai-sdk/provider-utils@3.0.0-canary.16
|
|
24
|
+
|
|
25
|
+
## 3.0.0-canary.18
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [2d03e19]
|
|
30
|
+
- Updated dependencies [319b989]
|
|
31
|
+
- Updated dependencies [441d042]
|
|
32
|
+
- Updated dependencies [dcc549b]
|
|
33
|
+
- Updated dependencies [cb2b53a]
|
|
34
|
+
- Updated dependencies [e244a78]
|
|
35
|
+
- ai@5.0.0-canary.19
|
|
36
|
+
|
|
3
37
|
## 3.0.0-canary.17
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.svelte.d.ts","sourceRoot":"","sources":["../src/chat.svelte.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"chat.svelte.d.ts","sourceRoot":"","sources":["../src/chat.svelte.ts"],"names":[],"mappings":"AACA,OAAO,EASL,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,cAAc,GAAG;IACf,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;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,mBA+BlD;IAEF,aAAa,4BAGV;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;KACjB,mBAmBC;CAgGH"}
|
package/dist/chat.svelte.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CompletionRequestOptions, type JSONValue, type UseCompletionOptions } from 'ai';
|
|
2
2
|
export type CompletionOptions = Readonly<UseCompletionOptions>;
|
|
3
3
|
export declare class Completion {
|
|
4
4
|
#private;
|
|
@@ -28,7 +28,7 @@ export declare class Completion {
|
|
|
28
28
|
/**
|
|
29
29
|
* Send a new prompt to the API endpoint and update the completion state.
|
|
30
30
|
*/
|
|
31
|
-
complete: (prompt: string, options?:
|
|
31
|
+
complete: (prompt: string, options?: CompletionRequestOptions) => Promise<string | null | undefined>;
|
|
32
32
|
/** Form submission handler to automatically reset input and call the completion API */
|
|
33
33
|
handleSubmit: (event?: {
|
|
34
34
|
preventDefault?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.svelte.d.ts","sourceRoot":"","sources":["../src/completion.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"completion.svelte.d.ts","sourceRoot":"","sources":["../src/completion.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACd,KAAK,oBAAoB,EAC1B,MAAM,IAAI,CAAC;AAOZ,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAE/D,qBAAa,UAAU;;IASrB,oCAAoC;IACpC,IAAI,UAAU,IAAI,MAAM,CAEvB;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED;;;;OAIG;IACH,IAAI,IAAI,IAGQ,SAAS,EAAE,CAD1B;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,EAE1B;IAED,0CAA0C;IAC1C,IAAI,KAAK,sBAER;IAED,mFAAmF;IACnF,KAAK,SAAqB;IAE1B;;OAEG;IACH,IAAI,OAAO,YAEV;gBAEW,OAAO,GAAE,iBAAsB;IAY3C;;OAEG;IACH,IAAI,aASF;IAEF;;OAEG;IACH,QAAQ,WAAkB,MAAM,YAAY,wBAAwB,wCAC5B;IAExC,uFAAuF;IACvF,YAAY,WAAkB;QAAE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,mBAK3D;CAsCH"}
|
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.19",
|
|
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": "5.0.0-canary.
|
|
40
|
-
"@ai-sdk/provider-utils": "3.0.0-canary.
|
|
39
|
+
"ai": "5.0.0-canary.20",
|
|
40
|
+
"@ai-sdk/provider-utils": "3.0.0-canary.16"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
package/src/chat.svelte.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
isAssistantMessageWithCompletedToolCalls,
|
|
9
9
|
shouldResubmitMessages,
|
|
10
10
|
updateToolCallResult,
|
|
11
|
-
type ChatRequest,
|
|
12
11
|
type ChatRequestOptions,
|
|
13
12
|
type CreateUIMessage,
|
|
14
13
|
type JSONValue,
|
|
@@ -180,11 +179,15 @@ export class Chat {
|
|
|
180
179
|
id: this.#generateId(),
|
|
181
180
|
createdAt: this.currentDate(),
|
|
182
181
|
role: 'user',
|
|
183
|
-
content: this.input,
|
|
184
182
|
parts: [...fileParts, { type: 'text', text: this.input }],
|
|
185
183
|
});
|
|
186
184
|
|
|
187
|
-
const chatRequest:
|
|
185
|
+
const chatRequest: {
|
|
186
|
+
headers?: Record<string, string> | Headers;
|
|
187
|
+
body?: object;
|
|
188
|
+
messages: UIMessage[];
|
|
189
|
+
data?: JSONValue;
|
|
190
|
+
} = {
|
|
188
191
|
messages,
|
|
189
192
|
headers: options.headers,
|
|
190
193
|
body: options.body,
|
|
@@ -223,7 +226,12 @@ export class Chat {
|
|
|
223
226
|
}
|
|
224
227
|
};
|
|
225
228
|
|
|
226
|
-
#triggerRequest = async (chatRequest:
|
|
229
|
+
#triggerRequest = async (chatRequest: {
|
|
230
|
+
headers?: Record<string, string> | Headers;
|
|
231
|
+
body?: object;
|
|
232
|
+
messages: UIMessage[];
|
|
233
|
+
data?: JSONValue;
|
|
234
|
+
}) => {
|
|
227
235
|
this.#store.status = 'submitted';
|
|
228
236
|
this.#store.error = undefined;
|
|
229
237
|
|
package/src/completion.svelte.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
callCompletionApi,
|
|
2
3
|
generateId,
|
|
3
|
-
type
|
|
4
|
+
type CompletionRequestOptions,
|
|
4
5
|
type JSONValue,
|
|
5
|
-
type
|
|
6
|
-
callCompletionApi,
|
|
6
|
+
type UseCompletionOptions,
|
|
7
7
|
} from 'ai';
|
|
8
8
|
import {
|
|
9
9
|
KeyedCompletionStore,
|
|
@@ -86,7 +86,7 @@ export class Completion {
|
|
|
86
86
|
/**
|
|
87
87
|
* Send a new prompt to the API endpoint and update the completion state.
|
|
88
88
|
*/
|
|
89
|
-
complete = async (prompt: string, options?:
|
|
89
|
+
complete = async (prompt: string, options?: CompletionRequestOptions) =>
|
|
90
90
|
this.#triggerRequest(prompt, options);
|
|
91
91
|
|
|
92
92
|
/** Form submission handler to automatically reset input and call the completion API */
|
|
@@ -97,7 +97,10 @@ export class Completion {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
#triggerRequest = async (
|
|
100
|
+
#triggerRequest = async (
|
|
101
|
+
prompt: string,
|
|
102
|
+
options?: CompletionRequestOptions,
|
|
103
|
+
) => {
|
|
101
104
|
return callCompletionApi({
|
|
102
105
|
api: this.#api,
|
|
103
106
|
prompt,
|