@ai-sdk/svelte 3.0.0-alpha.12 → 3.0.0-alpha.14

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,30 @@
1
1
  # @ai-sdk/svelte
2
2
 
3
+ ## 3.0.0-alpha.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [63f9e9b]
8
+ - ai@5.0.0-alpha.14
9
+ - @ai-sdk/provider-utils@3.0.0-alpha.14
10
+
11
+ ## 3.0.0-alpha.13
12
+
13
+ ### Major Changes
14
+
15
+ - 0a710d8: feat (ui): typed tool parts in ui messages
16
+ - 901df02: feat (ui): use UI_MESSAGE generic
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [0a710d8]
21
+ - Updated dependencies [6a83f7d]
22
+ - Updated dependencies [1f55c21]
23
+ - Updated dependencies [33eb499]
24
+ - Updated dependencies [901df02]
25
+ - ai@5.0.0-alpha.13
26
+ - @ai-sdk/provider-utils@3.0.0-alpha.13
27
+
3
28
  ## 3.0.0-alpha.12
4
29
 
5
30
  ### Patch Changes
@@ -1,6 +1,6 @@
1
- import { AbstractChat, type ChatInit, type CreateUIMessage, type UIDataPartSchemas, type UIMessage } from 'ai';
1
+ import { AbstractChat, type ChatInit, type CreateUIMessage, type UIMessage } from 'ai';
2
2
  export type { CreateUIMessage, UIMessage };
3
- export declare class Chat<MESSAGE_METADATA = unknown, DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas> extends AbstractChat<MESSAGE_METADATA, DATA_PART_SCHEMAS> {
4
- constructor(init: ChatInit<MESSAGE_METADATA, DATA_PART_SCHEMAS>);
3
+ export declare class Chat<UI_MESSAGE extends UIMessage = UIMessage> extends AbstractChat<UI_MESSAGE> {
4
+ constructor(init: ChatInit<UI_MESSAGE>);
5
5
  }
6
6
  //# sourceMappingURL=chat.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.svelte.d.ts","sourceRoot":"","sources":["../src/chat.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,QAAQ,EAGb,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,SAAS,EACf,MAAM,IAAI,CAAC;AAEZ,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAE3C,qBAAa,IAAI,CACf,gBAAgB,GAAG,OAAO,EAC1B,iBAAiB,SAAS,iBAAiB,GAAG,iBAAiB,CAC/D,SAAQ,YAAY,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;gBAC7C,IAAI,EAAE,QAAQ,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;CAMhE"}
1
+ {"version":3,"file":"chat.svelte.d.ts","sourceRoot":"","sources":["../src/chat.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,QAAQ,EAGb,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,IAAI,CAAC;AAEZ,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAE3C,qBAAa,IAAI,CACf,UAAU,SAAS,SAAS,GAAG,SAAS,CACxC,SAAQ,YAAY,CAAC,UAAU,CAAC;gBACpB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC;CAMvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/svelte",
3
- "version": "3.0.0-alpha.12",
3
+ "version": "3.0.0-alpha.14",
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-alpha.12",
40
- "@ai-sdk/provider-utils": "3.0.0-alpha.12"
39
+ "ai": "5.0.0-alpha.14",
40
+ "@ai-sdk/provider-utils": "3.0.0-alpha.14"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -4,18 +4,15 @@ import {
4
4
  type ChatState,
5
5
  type ChatStatus,
6
6
  type CreateUIMessage,
7
- type UIDataPartSchemas,
8
- type UIDataTypes,
9
7
  type UIMessage,
10
8
  } from 'ai';
11
9
 
12
10
  export type { CreateUIMessage, UIMessage };
13
11
 
14
12
  export class Chat<
15
- MESSAGE_METADATA = unknown,
16
- DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas,
17
- > extends AbstractChat<MESSAGE_METADATA, DATA_PART_SCHEMAS> {
18
- constructor(init: ChatInit<MESSAGE_METADATA, DATA_PART_SCHEMAS>) {
13
+ UI_MESSAGE extends UIMessage = UIMessage,
14
+ > extends AbstractChat<UI_MESSAGE> {
15
+ constructor(init: ChatInit<UI_MESSAGE>) {
19
16
  super({
20
17
  ...init,
21
18
  state: new SvelteChatState(init.messages),
@@ -23,22 +20,22 @@ export class Chat<
23
20
  }
24
21
  }
25
22
 
26
- class SvelteChatState<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes>
27
- implements ChatState<MESSAGE_METADATA, DATA_TYPES>
23
+ class SvelteChatState<UI_MESSAGE extends UIMessage>
24
+ implements ChatState<UI_MESSAGE>
28
25
  {
29
- messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[];
26
+ messages: UI_MESSAGE[];
30
27
  status = $state<ChatStatus>('ready');
31
28
  error = $state<Error | undefined>(undefined);
32
29
 
33
- constructor(messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[] = []) {
30
+ constructor(messages: UI_MESSAGE[] = []) {
34
31
  this.messages = $state(messages);
35
32
  }
36
33
 
37
- setMessages = (messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[]) => {
34
+ setMessages = (messages: UI_MESSAGE[]) => {
38
35
  this.messages = messages;
39
36
  };
40
37
 
41
- pushMessage = (message: UIMessage<MESSAGE_METADATA, DATA_TYPES>) => {
38
+ pushMessage = (message: UI_MESSAGE) => {
42
39
  this.messages.push(message);
43
40
  };
44
41
 
@@ -46,10 +43,7 @@ class SvelteChatState<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes>
46
43
  this.messages.pop();
47
44
  };
48
45
 
49
- replaceMessage = (
50
- index: number,
51
- message: UIMessage<MESSAGE_METADATA, DATA_TYPES>,
52
- ) => {
46
+ replaceMessage = (index: number, message: UI_MESSAGE) => {
53
47
  this.messages[index] = message;
54
48
  };
55
49