@ai-sdk/svelte 5.0.152 → 5.0.153

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +44 -4
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ai-sdk/svelte
2
2
 
3
+ ## 5.0.153
4
+
5
+ ### Patch Changes
6
+
7
+ - e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
8
+ - Updated dependencies [5475347]
9
+ - Updated dependencies [e729d58]
10
+ - ai@7.0.153
11
+ - @ai-sdk/provider-utils@5.0.68
12
+
3
13
  ## 5.0.152
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -2,8 +2,48 @@
2
2
 
3
3
  [Svelte](https://svelte.dev/) UI components for the [AI SDK](https://ai-sdk.dev/docs):
4
4
 
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)
5
+ ## Setup
8
6
 
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)
7
+ ```bash
8
+ npm i ai @ai-sdk/svelte
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```svelte
14
+ <script lang="ts">
15
+ import { Chat } from '@ai-sdk/svelte';
16
+
17
+ let input = '';
18
+ const chat = new Chat({});
19
+
20
+ function handleSubmit(event: SubmitEvent) {
21
+ event.preventDefault();
22
+ chat.sendMessage({ text: input });
23
+ input = '';
24
+ }
25
+ </script>
26
+
27
+ <main>
28
+ <ul>
29
+ {#each chat.messages as message, messageIndex (messageIndex)}
30
+ <li>
31
+ <div>{message.role}</div>
32
+ <div>
33
+ {#each message.parts as part, partIndex (partIndex)}
34
+ {#if part.type === 'text'}
35
+ <div>{part.text}</div>
36
+ {/if}
37
+ {/each}
38
+ </div>
39
+ </li>
40
+ {/each}
41
+ </ul>
42
+ <form onsubmit={handleSubmit}>
43
+ <input bind:value={input} />
44
+ <button type="submit">Send</button>
45
+ </form>
46
+ </main>
47
+ ```
48
+
49
+ See the [Svelte documentation](https://ai-sdk.dev/docs/getting-started/svelte) for more information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/svelte",
3
- "version": "5.0.152",
3
+ "version": "5.0.153",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist",
@@ -34,8 +34,8 @@
34
34
  "svelte": "^5.31.0"
35
35
  },
36
36
  "dependencies": {
37
- "@ai-sdk/provider-utils": "5.0.67",
38
- "ai": "7.0.152"
37
+ "@ai-sdk/provider-utils": "5.0.68",
38
+ "ai": "7.0.153"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@ai-sdk/test-server": "2.0.4",